2022-01-01 13:38:12 +00:00
|
|
|
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
|
2021-06-01 12:20:20 +00:00
|
|
|
|
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',
|
2021-07-01 11:23:52 +00:00
|
|
|
webhook_id: Faker::Number.number(digits: 19),
|
2020-02-17 10:37:36 +00:00
|
|
|
}
|
|
|
|
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
|
2020-02-21 04:42:25 +00:00
|
|
|
consumer_key { ENV.fetch('TWITTER_CONSUMER_KEY') { 'REDACTED' } }
|
|
|
|
consumer_secret { ENV.fetch('TWITTER_CONSUMER_SECRET') { 'REDACTED' } }
|
|
|
|
oauth_token { ENV.fetch('TWITTER_OAUTH_TOKEN') { 'REDACTED' } }
|
|
|
|
oauth_token_secret { ENV.fetch('TWITTER_OAUTH_TOKEN_SECRET') { 'REDACTED' } }
|
2020-02-17 10:37:36 +00:00
|
|
|
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
|