2019-07-25 01:11:48 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-12-13 19:13:44 -05:00
|
|
|
FactoryBot.define do
|
2022-01-10 13:14:07 -05:00
|
|
|
factory :integration do
|
2017-08-02 15:55:11 -04:00
|
|
|
project
|
2021-05-12 08:10:24 -04:00
|
|
|
type { 'Integration' }
|
2017-04-25 11:48:12 -04:00
|
|
|
end
|
|
|
|
|
2021-06-09 14:11:25 -04:00
|
|
|
factory :custom_issue_tracker_integration, class: 'Integrations::CustomIssueTracker' do
|
2017-08-02 15:55:11 -04:00
|
|
|
project
|
2019-10-01 20:06:26 -04:00
|
|
|
active { true }
|
2019-09-16 11:06:26 -04:00
|
|
|
issue_tracker
|
2016-02-16 22:55:24 -05:00
|
|
|
end
|
2017-02-07 10:59:38 -05:00
|
|
|
|
2022-02-21 22:14:19 -05:00
|
|
|
factory :jenkins_integration, class: 'Integrations::Jenkins' do
|
|
|
|
project
|
|
|
|
active { true }
|
|
|
|
type { 'Integrations::Jenkins' }
|
|
|
|
jenkins_url { 'http://jenkins.example.com/' }
|
|
|
|
project_name { 'my-project' }
|
|
|
|
username { 'jenkings-user' }
|
|
|
|
password { 'passw0rd' }
|
|
|
|
end
|
|
|
|
|
2021-08-25 20:09:31 -04:00
|
|
|
factory :datadog_integration, class: 'Integrations::Datadog' do
|
|
|
|
project
|
|
|
|
active { true }
|
|
|
|
api_key { 'secret' }
|
|
|
|
end
|
|
|
|
|
2021-06-16 14:10:35 -04:00
|
|
|
factory :emails_on_push_integration, class: 'Integrations::EmailsOnPush' do
|
2019-08-15 13:37:36 -04:00
|
|
|
project
|
2022-02-21 22:14:19 -05:00
|
|
|
type { 'Integrations::EmailsOnPush' }
|
2019-10-01 20:06:26 -04:00
|
|
|
active { true }
|
|
|
|
push_events { true }
|
|
|
|
tag_push_events { true }
|
|
|
|
properties do
|
|
|
|
{
|
|
|
|
recipients: 'test@example.com',
|
|
|
|
disable_diffs: true,
|
|
|
|
send_from_committer_email: true
|
|
|
|
}
|
|
|
|
end
|
2019-08-15 13:37:36 -04:00
|
|
|
end
|
|
|
|
|
2021-06-18 17:10:06 -04:00
|
|
|
factory :prometheus_integration, class: 'Integrations::Prometheus' do
|
2017-08-02 15:55:11 -04:00
|
|
|
project
|
2019-10-01 20:06:26 -04:00
|
|
|
active { true }
|
|
|
|
properties do
|
|
|
|
{
|
|
|
|
api_url: 'https://prometheus.example.com/',
|
|
|
|
manual_configuration: true
|
|
|
|
}
|
|
|
|
end
|
2017-05-31 07:40:03 -04:00
|
|
|
end
|
|
|
|
|
2021-06-15 20:10:15 -04:00
|
|
|
factory :drone_ci_integration, class: 'Integrations::DroneCi' do
|
2019-12-17 10:08:15 -05:00
|
|
|
project
|
|
|
|
active { true }
|
|
|
|
drone_url { 'https://bamboo.example.com' }
|
|
|
|
token { 'test' }
|
|
|
|
end
|
|
|
|
|
2021-06-18 11:10:16 -04:00
|
|
|
factory :jira_integration, class: 'Integrations::Jira' do
|
2017-08-02 15:55:11 -04:00
|
|
|
project
|
2019-10-01 20:06:26 -04:00
|
|
|
active { true }
|
2022-02-21 22:14:19 -05:00
|
|
|
type { 'Integrations::Jira' }
|
2019-09-16 11:06:26 -04:00
|
|
|
|
|
|
|
transient do
|
2019-10-01 20:06:26 -04:00
|
|
|
create_data { true }
|
|
|
|
url { 'https://jira.example.com' }
|
2021-07-21 08:09:35 -04:00
|
|
|
api_url { '' }
|
2019-10-01 20:06:26 -04:00
|
|
|
username { 'jira_username' }
|
|
|
|
password { 'jira_password' }
|
2021-03-29 17:09:08 -04:00
|
|
|
jira_issue_transition_automatic { false }
|
2019-10-01 20:06:26 -04:00
|
|
|
jira_issue_transition_id { '56-1' }
|
2020-07-15 11:09:21 -04:00
|
|
|
issues_enabled { false }
|
|
|
|
project_key { nil }
|
2020-11-13 01:09:02 -05:00
|
|
|
vulnerabilities_enabled { false }
|
|
|
|
vulnerabilities_issuetype { nil }
|
2021-04-14 08:09:25 -04:00
|
|
|
deployment_type { 'cloud' }
|
2019-09-16 11:06:26 -04:00
|
|
|
end
|
|
|
|
|
2021-05-12 08:10:24 -04:00
|
|
|
after(:build) do |integration, evaluator|
|
2019-09-16 11:06:26 -04:00
|
|
|
if evaluator.create_data
|
2021-05-12 08:10:24 -04:00
|
|
|
integration.jira_tracker_data = build(:jira_tracker_data,
|
|
|
|
integration: integration, url: evaluator.url, api_url: evaluator.api_url,
|
|
|
|
jira_issue_transition_automatic: evaluator.jira_issue_transition_automatic,
|
|
|
|
jira_issue_transition_id: evaluator.jira_issue_transition_id,
|
|
|
|
username: evaluator.username, password: evaluator.password, issues_enabled: evaluator.issues_enabled,
|
|
|
|
project_key: evaluator.project_key, vulnerabilities_enabled: evaluator.vulnerabilities_enabled,
|
|
|
|
vulnerabilities_issuetype: evaluator.vulnerabilities_issuetype, deployment_type: evaluator.deployment_type
|
2019-09-16 11:06:26 -04:00
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
2017-03-03 09:25:52 -05:00
|
|
|
end
|
2017-05-22 06:07:12 -04:00
|
|
|
|
2021-08-31 08:11:07 -04:00
|
|
|
factory :zentao_integration, class: 'Integrations::Zentao' do
|
|
|
|
project
|
|
|
|
active { true }
|
2022-02-21 22:14:19 -05:00
|
|
|
type { 'Integrations::Zentao' }
|
2021-08-31 08:11:07 -04:00
|
|
|
|
|
|
|
transient do
|
|
|
|
create_data { true }
|
|
|
|
url { 'https://jihudemo.zentao.net' }
|
|
|
|
api_url { '' }
|
|
|
|
api_token { 'ZENTAO_TOKEN' }
|
|
|
|
zentao_product_xid { '3' }
|
|
|
|
end
|
|
|
|
|
|
|
|
after(:build) do |integration, evaluator|
|
|
|
|
if evaluator.create_data
|
|
|
|
integration.zentao_tracker_data = build(:zentao_tracker_data,
|
|
|
|
integration: integration,
|
|
|
|
url: evaluator.url,
|
|
|
|
api_url: evaluator.api_url,
|
|
|
|
api_token: evaluator.api_token,
|
|
|
|
zentao_product_xid: evaluator.zentao_product_xid
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-11-09 13:13:13 -05:00
|
|
|
factory :shimo_integration, class: 'Integrations::Shimo' do
|
|
|
|
project
|
|
|
|
active { true }
|
|
|
|
external_wiki_url { 'https://shimo.example.com/desktop' }
|
|
|
|
end
|
|
|
|
|
2021-06-09 14:11:25 -04:00
|
|
|
factory :confluence_integration, class: 'Integrations::Confluence' do
|
2020-07-14 08:09:14 -04:00
|
|
|
project
|
|
|
|
active { true }
|
|
|
|
confluence_url { 'https://example.atlassian.net/wiki' }
|
|
|
|
end
|
|
|
|
|
2021-06-09 14:11:25 -04:00
|
|
|
factory :bugzilla_integration, class: 'Integrations::Bugzilla' do
|
2019-06-26 10:03:57 -04:00
|
|
|
project
|
2019-10-01 20:06:26 -04:00
|
|
|
active { true }
|
2019-06-26 10:03:57 -04:00
|
|
|
issue_tracker
|
|
|
|
end
|
|
|
|
|
2021-06-18 11:10:16 -04:00
|
|
|
factory :redmine_integration, class: 'Integrations::Redmine' do
|
2019-06-26 10:03:57 -04:00
|
|
|
project
|
2019-10-01 20:06:26 -04:00
|
|
|
active { true }
|
2019-06-26 10:03:57 -04:00
|
|
|
issue_tracker
|
|
|
|
end
|
|
|
|
|
2021-06-21 08:07:45 -04:00
|
|
|
factory :youtrack_integration, class: 'Integrations::Youtrack' do
|
2019-06-26 10:03:57 -04:00
|
|
|
project
|
2019-10-01 20:06:26 -04:00
|
|
|
active { true }
|
2019-06-26 10:03:57 -04:00
|
|
|
issue_tracker
|
|
|
|
end
|
|
|
|
|
2021-06-16 14:10:35 -04:00
|
|
|
factory :ewm_integration, class: 'Integrations::Ewm' do
|
2020-09-14 08:09:34 -04:00
|
|
|
project
|
|
|
|
active { true }
|
|
|
|
issue_tracker
|
|
|
|
end
|
|
|
|
|
2019-06-26 10:03:57 -04:00
|
|
|
trait :issue_tracker do
|
2019-09-16 11:06:26 -04:00
|
|
|
transient do
|
2019-10-01 20:06:26 -04:00
|
|
|
create_data { true }
|
|
|
|
project_url { 'http://issuetracker.example.com' }
|
|
|
|
issues_url { 'http://issues.example.com/issues/:id' }
|
|
|
|
new_issue_url { 'http://new-issue.example.com' }
|
2019-09-16 11:06:26 -04:00
|
|
|
end
|
|
|
|
|
2021-05-12 08:10:24 -04:00
|
|
|
after(:build) do |integration, evaluator|
|
2019-09-16 11:06:26 -04:00
|
|
|
if evaluator.create_data
|
2021-05-12 08:10:24 -04:00
|
|
|
integration.issue_tracker_data = build(:issue_tracker_data,
|
|
|
|
integration: integration, project_url: evaluator.project_url,
|
|
|
|
issues_url: evaluator.issues_url, new_issue_url: evaluator.new_issue_url
|
2019-09-16 11:06:26 -04:00
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
2019-06-26 10:03:57 -04:00
|
|
|
end
|
|
|
|
|
2021-06-16 14:10:35 -04:00
|
|
|
factory :external_wiki_integration, class: 'Integrations::ExternalWiki' do
|
2020-10-22 20:08:30 -04:00
|
|
|
project
|
2022-02-21 22:14:19 -05:00
|
|
|
type { 'Integrations::ExternalWiki' }
|
2020-10-22 20:08:30 -04:00
|
|
|
active { true }
|
|
|
|
external_wiki_url { 'http://external-wiki-url.com' }
|
|
|
|
end
|
|
|
|
|
2019-07-11 05:53:08 -04:00
|
|
|
trait :jira_cloud_service do
|
2019-10-01 20:06:26 -04:00
|
|
|
url { 'https://mysite.atlassian.net' }
|
|
|
|
username { 'jira_user' }
|
|
|
|
password { 'my-secret-password' }
|
2018-11-03 20:37:47 -04:00
|
|
|
end
|
2019-07-04 13:09:58 -04:00
|
|
|
|
2022-02-21 22:14:19 -05:00
|
|
|
trait :chat_notification do
|
2022-04-13 11:08:16 -04:00
|
|
|
sequence(:webhook) { |n| "https://example.com/webhook/#{n}" }
|
2022-02-21 22:14:19 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
trait :inactive do
|
|
|
|
active { false }
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :mattermost_integration, class: 'Integrations::Mattermost' do
|
|
|
|
chat_notification
|
|
|
|
project
|
|
|
|
type { 'Integrations::Mattermost' }
|
|
|
|
active { true }
|
|
|
|
end
|
|
|
|
|
2021-06-18 11:10:16 -04:00
|
|
|
# avoids conflict with slack_integration factory
|
|
|
|
factory :integrations_slack, class: 'Integrations::Slack' do
|
2022-02-21 22:14:19 -05:00
|
|
|
chat_notification
|
2020-05-14 11:08:14 -04:00
|
|
|
project
|
|
|
|
active { true }
|
2022-02-21 22:14:19 -05:00
|
|
|
type { 'Integrations::Slack' }
|
2020-05-14 11:08:14 -04:00
|
|
|
end
|
|
|
|
|
2021-06-18 11:10:16 -04:00
|
|
|
factory :slack_slash_commands_integration, class: 'Integrations::SlackSlashCommands' do
|
2021-06-03 05:10:18 -04:00
|
|
|
project
|
|
|
|
active { true }
|
2022-02-21 22:14:19 -05:00
|
|
|
type { 'Integrations::SlackSlashCommands' }
|
2021-06-03 05:10:18 -04:00
|
|
|
end
|
|
|
|
|
2021-06-17 23:10:18 -04:00
|
|
|
factory :pipelines_email_integration, class: 'Integrations::PipelinesEmail' do
|
2020-06-09 08:08:55 -04:00
|
|
|
project
|
|
|
|
active { true }
|
2022-02-21 22:14:19 -05:00
|
|
|
type { 'Integrations::PipelinesEmail' }
|
2020-06-09 08:08:55 -04:00
|
|
|
recipients { 'test@example.com' }
|
|
|
|
end
|
|
|
|
|
2022-03-07 04:13:09 -05:00
|
|
|
factory :pivotaltracker_integration, class: 'Integrations::Pivotaltracker' do
|
|
|
|
project
|
|
|
|
active { true }
|
|
|
|
token { 'test' }
|
|
|
|
end
|
|
|
|
|
2022-03-16 14:08:16 -04:00
|
|
|
factory :harbor_integration, class: 'Integrations::Harbor' do
|
|
|
|
project
|
|
|
|
active { true }
|
2022-07-13 20:08:59 -04:00
|
|
|
type { 'Integrations::Harbor' }
|
2022-03-16 14:08:16 -04:00
|
|
|
|
|
|
|
url { 'https://demo.goharbor.io' }
|
|
|
|
project_name { 'testproject' }
|
|
|
|
username { 'harborusername' }
|
|
|
|
password { 'harborpassword' }
|
|
|
|
end
|
|
|
|
|
2019-09-16 11:06:26 -04:00
|
|
|
# this is for testing storing values inside properties, which is deprecated and will be removed in
|
2019-09-26 08:06:00 -04:00
|
|
|
# https://gitlab.com/gitlab-org/gitlab/issues/29404
|
2019-07-04 13:09:58 -04:00
|
|
|
trait :without_properties_callback do
|
2019-10-01 20:06:26 -04:00
|
|
|
jira_tracker_data { nil }
|
|
|
|
issue_tracker_data { nil }
|
|
|
|
create_data { false }
|
2019-09-16 11:06:26 -04:00
|
|
|
|
2021-05-12 08:10:24 -04:00
|
|
|
after(:build) do
|
2021-06-03 23:10:08 -04:00
|
|
|
Integrations::BaseIssueTracker.skip_callback(:validation, :before, :handle_properties)
|
2019-07-04 13:09:58 -04:00
|
|
|
end
|
|
|
|
|
2020-07-21 08:09:30 -04:00
|
|
|
to_create { |instance| instance.save!(validate: false) }
|
2019-09-16 11:06:26 -04:00
|
|
|
|
|
|
|
after(:create) do
|
2021-06-03 23:10:08 -04:00
|
|
|
Integrations::BaseIssueTracker.set_callback(:validation, :before, :handle_properties)
|
2019-07-04 13:09:58 -04:00
|
|
|
end
|
|
|
|
end
|
2020-03-14 02:09:14 -04:00
|
|
|
|
2021-11-12 01:10:23 -05:00
|
|
|
trait :group do
|
|
|
|
group
|
|
|
|
project { nil }
|
|
|
|
end
|
|
|
|
|
2020-03-14 02:09:14 -04:00
|
|
|
trait :instance do
|
|
|
|
project { nil }
|
|
|
|
instance { true }
|
|
|
|
end
|
2016-02-16 22:55:24 -05:00
|
|
|
end
|