2018-04-24 13:26:09 +00:00
|
|
|
FactoryBot.define do
|
|
|
|
factory :channel do
|
2019-03-27 09:01:36 +00:00
|
|
|
area { 'Email::Dummy' }
|
|
|
|
group { ::Group.find(1) }
|
|
|
|
active { true }
|
|
|
|
options {}
|
|
|
|
preferences {}
|
|
|
|
updated_by_id { 1 }
|
|
|
|
created_by_id { 1 }
|
2018-12-13 09:06:44 +00:00
|
|
|
|
2019-01-15 13:11:57 +00:00
|
|
|
factory :email_channel do
|
2019-03-27 09:01:36 +00:00
|
|
|
area { 'Email::Account' }
|
2019-01-15 13:11:57 +00:00
|
|
|
options do
|
|
|
|
{
|
|
|
|
inbound: {
|
|
|
|
adapter: 'null', options: {}
|
|
|
|
},
|
|
|
|
outbound: {
|
|
|
|
adapter: 'sendmail'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-12-13 09:06:44 +00:00
|
|
|
factory :twitter_channel do
|
2019-03-27 09:01:36 +00:00
|
|
|
area { 'Twitter::Account' }
|
2018-12-13 09:06:44 +00:00
|
|
|
options do
|
|
|
|
{
|
2020-02-17 10:37:36 +00:00
|
|
|
adapter: 'twitter',
|
|
|
|
user: {
|
|
|
|
id: oauth_token&.split('-')&.first,
|
|
|
|
screen_name: 'nicole_braun',
|
|
|
|
name: 'Nicole Braun',
|
2018-12-13 09:06:44 +00:00
|
|
|
},
|
2020-02-17 10:37:36 +00:00
|
|
|
auth: {
|
|
|
|
external_credential_id: external_credential.id,
|
|
|
|
oauth_token: oauth_token,
|
|
|
|
oauth_token_secret: oauth_token_secret,
|
2018-12-13 09:06:44 +00:00
|
|
|
},
|
2020-02-17 10:37:36 +00:00
|
|
|
sync: {
|
|
|
|
webhook_id: '',
|
|
|
|
mentions: {
|
|
|
|
group_id: Group.first.id
|
|
|
|
},
|
|
|
|
direct_messages: {
|
|
|
|
group_id: Group.first.id
|
|
|
|
},
|
|
|
|
search: [
|
2018-12-13 09:06:44 +00:00
|
|
|
{
|
2020-03-12 18:28:50 +00:00
|
|
|
term: search_term,
|
2018-12-18 10:40:56 +00:00
|
|
|
group_id: Group.first.id
|
2018-12-13 09:06:44 +00:00
|
|
|
},
|
|
|
|
],
|
2020-02-17 10:37:36 +00:00
|
|
|
},
|
|
|
|
subscribed_to_webhook_id: external_credential.credentials[:webhook_id],
|
2018-12-18 10:40:56 +00:00
|
|
|
}.deep_merge(custom_options)
|
2018-12-13 09:06:44 +00:00
|
|
|
end
|
2020-02-17 10:37:36 +00:00
|
|
|
|
|
|
|
transient do
|
|
|
|
custom_options { {} }
|
|
|
|
external_credential { create(:twitter_credential) }
|
|
|
|
oauth_token { external_credential.credentials[:oauth_token] }
|
|
|
|
oauth_token_secret { external_credential.credentials[:oauth_token_secret] }
|
2020-03-12 18:28:50 +00:00
|
|
|
search_term { 'zammad' }
|
2020-02-17 10:37:36 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
trait :legacy do
|
|
|
|
transient do
|
|
|
|
custom_options { { sync: { import_older_tweets: true } } }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :invalid do
|
|
|
|
transient do
|
|
|
|
external_credential { create(:twitter_credential, :invalid) }
|
|
|
|
end
|
|
|
|
end
|
2018-12-13 09:06:44 +00:00
|
|
|
end
|
2018-04-24 13:26:09 +00:00
|
|
|
end
|
|
|
|
end
|