2018-09-26 09:51:53 +00:00
|
|
|
FactoryBot.define do
|
|
|
|
factory :external_credential do
|
2018-12-12 08:57:30 +00:00
|
|
|
factory :facebook_credential do
|
2019-03-27 09:01:36 +00:00
|
|
|
name { 'facebook' }
|
2018-12-12 08:57:30 +00:00
|
|
|
credentials { { application_id: 123, application_secret: 123 } }
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :twitter_credential do
|
2019-03-27 09:01:36 +00:00
|
|
|
name { 'twitter' }
|
2018-12-12 08:57:30 +00:00
|
|
|
|
|
|
|
credentials do
|
2020-02-17 10:37:36 +00:00
|
|
|
{
|
|
|
|
consumer_key: consumer_key,
|
|
|
|
consumer_secret: consumer_secret,
|
|
|
|
oauth_token: oauth_token,
|
|
|
|
oauth_token_secret: oauth_token_secret,
|
|
|
|
env: 'zammad',
|
|
|
|
controller: 'external_credentials',
|
|
|
|
action: 'app_verify',
|
|
|
|
provider: 'twitter',
|
|
|
|
webhook_id: Faker::Number.number(19),
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2020-04-01 03:53:43 +00:00
|
|
|
# When recording a new VCR cassette,
|
|
|
|
# Twitter API tests need valid credentials--
|
|
|
|
# but storing them in this file is a security no-no.
|
2020-02-17 10:37:36 +00:00
|
|
|
#
|
2020-04-01 03:53:43 +00:00
|
|
|
# Instead, store your twitter API credentials in env vars to utilize this factory.
|
|
|
|
# (Try https://github.com/direnv/direnv to set env vars automatically.)
|
2020-02-17 10:37:36 +00:00
|
|
|
transient do
|
|
|
|
consumer_key { 'REDACTED' }
|
|
|
|
consumer_secret { 'REDACTED' }
|
|
|
|
oauth_token { 'REDACTED' }
|
|
|
|
oauth_token_secret { 'REDACTED' }
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :invalid do
|
|
|
|
# If these credentials are fake/invalid,
|
|
|
|
# why don't we use Faker to generate them dynamically?
|
|
|
|
#
|
|
|
|
# Our Twitter API tests use VCR to cache HTTP traffic.
|
|
|
|
# If the values change each time you run the test,
|
|
|
|
# VCR gets confused and raises errors.
|
|
|
|
transient do
|
|
|
|
consumer_key { 'q7K8GEkhyCHs9jHLtkmD9Kod4' }
|
|
|
|
consumer_secret { 'LIDrpO6lRukO0PSicv00x9n8qMPvqvMq9mNInsby5sIkwN2J81' }
|
|
|
|
oauth_token { '7783712304-H9s75r2d532diPmJYK6JrvUWxu9gTDZ6ocjfToL' }
|
|
|
|
oauth_token_secret { 'XFhmXR1J17zaI3bEikHKG5zNUVHVnjpzPuQc0vNmb4z2y' }
|
|
|
|
end
|
2018-12-12 08:57:30 +00:00
|
|
|
end
|
|
|
|
end
|
2018-09-26 09:51:53 +00:00
|
|
|
end
|
|
|
|
end
|