diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-28 22:05:40 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-28 22:05:44 +0000 |
commit | f5897da89ca63facbef54c23cff894f2bbe8e644 (patch) | |
tree | 9671f60e71b3cb78705a211977870fb1c5a4b354 /spec/models/integrations | |
parent | 10d9a3bf50cca85dd857c5306a34d7a6032580e6 (diff) | |
download | gitlab-ce-f5897da89ca63facbef54c23cff894f2bbe8e644.tar.gz |
Add latest changes from gitlab-org/security/gitlab@15-4-stable-ee
Diffstat (limited to 'spec/models/integrations')
-rw-r--r-- | spec/models/integrations/buildkite_spec.rb | 4 | ||||
-rw-r--r-- | spec/models/integrations/datadog_spec.rb | 15 | ||||
-rw-r--r-- | spec/models/integrations/drone_ci_spec.rb | 2 | ||||
-rw-r--r-- | spec/models/integrations/packagist_spec.rb | 2 |
4 files changed, 12 insertions, 11 deletions
diff --git a/spec/models/integrations/buildkite_spec.rb b/spec/models/integrations/buildkite_spec.rb index 38ceb5db49c..c720dc6d418 100644 --- a/spec/models/integrations/buildkite_spec.rb +++ b/spec/models/integrations/buildkite_spec.rb @@ -19,7 +19,7 @@ RSpec.describe Integrations::Buildkite, :use_clean_rails_memory_store_caching do end it_behaves_like Integrations::HasWebHook do - let(:hook_url) { 'https://webhook.buildkite.com/deliver/secret-sauce-webhook-token' } + let(:hook_url) { 'https://webhook.buildkite.com/deliver/{webhook_token}' } end describe 'Validations' do @@ -68,7 +68,7 @@ RSpec.describe Integrations::Buildkite, :use_clean_rails_memory_store_caching do describe '#hook_url' do it 'returns the webhook url' do expect(integration.hook_url).to eq( - 'https://webhook.buildkite.com/deliver/secret-sauce-webhook-token' + 'https://webhook.buildkite.com/deliver/{webhook_token}' ) end end diff --git a/spec/models/integrations/datadog_spec.rb b/spec/models/integrations/datadog_spec.rb index 4ac684e8ff0..b7da6a79e44 100644 --- a/spec/models/integrations/datadog_spec.rb +++ b/spec/models/integrations/datadog_spec.rb @@ -19,6 +19,7 @@ RSpec.describe Integrations::Datadog do let(:dd_tags) { '' } let(:expected_hook_url) { default_url + "?dd-api-key=#{api_key}&env=#{dd_env}&service=#{dd_service}" } + let(:hook_url) { default_url + "?dd-api-key={api_key}&env=#{dd_env}&service=#{dd_service}" } let(:instance) do described_class.new( @@ -48,7 +49,7 @@ RSpec.describe Integrations::Datadog do it_behaves_like Integrations::HasWebHook do let(:integration) { instance } - let(:hook_url) { "#{described_class::URL_TEMPLATE % { datadog_domain: dd_site }}?dd-api-key=#{api_key}&env=#{dd_env}&service=#{dd_service}" } + let(:hook_url) { "#{described_class::URL_TEMPLATE % { datadog_domain: dd_site }}?dd-api-key={api_key}&env=#{dd_env}&service=#{dd_service}" } end describe 'validations' do @@ -132,18 +133,18 @@ RSpec.describe Integrations::Datadog do subject { instance.hook_url } context 'with standard site URL' do - it { is_expected.to eq(expected_hook_url) } + it { is_expected.to eq(hook_url) } end context 'with custom URL' do let(:api_url) { 'https://webhook-intake.datad0g.com/api/v2/webhook' } - it { is_expected.to eq(api_url + "?dd-api-key=#{api_key}&env=#{dd_env}&service=#{dd_service}") } + it { is_expected.to eq(api_url + "?dd-api-key={api_key}&env=#{dd_env}&service=#{dd_service}") } context 'blank' do let(:api_url) { '' } - it { is_expected.to eq(expected_hook_url) } + it { is_expected.to eq(hook_url) } end end @@ -152,19 +153,19 @@ RSpec.describe Integrations::Datadog do let(:dd_env) { '' } let(:dd_tags) { '' } - it { is_expected.to eq(default_url + "?dd-api-key=#{api_key}") } + it { is_expected.to eq(default_url + "?dd-api-key={api_key}") } end context 'with custom tags' do let(:dd_tags) { "key:value\nkey2:value, 2" } let(:escaped_tags) { CGI.escape("key:value,\"key2:value, 2\"") } - it { is_expected.to eq(expected_hook_url + "&tags=#{escaped_tags}") } + it { is_expected.to eq(hook_url + "&tags=#{escaped_tags}") } context 'and empty lines' do let(:dd_tags) { "key:value\r\n\n\n\nkey2:value, 2\n" } - it { is_expected.to eq(expected_hook_url + "&tags=#{escaped_tags}") } + it { is_expected.to eq(hook_url + "&tags=#{escaped_tags}") } end end end diff --git a/spec/models/integrations/drone_ci_spec.rb b/spec/models/integrations/drone_ci_spec.rb index 905fee075ad..f3203a6e69d 100644 --- a/spec/models/integrations/drone_ci_spec.rb +++ b/spec/models/integrations/drone_ci_spec.rb @@ -116,7 +116,7 @@ RSpec.describe Integrations::DroneCi, :use_clean_rails_memory_store_caching do include_context :drone_ci_integration let(:integration) { drone } - let(:hook_url) { "#{drone_url}/hook?owner=#{project.namespace.full_path}&name=#{project.path}&access_token=#{token}" } + let(:hook_url) { "#{drone_url}/hook?owner=#{project.namespace.full_path}&name=#{project.path}&access_token={token}" } it 'does not create a hook if project is not present' do integration.project = nil diff --git a/spec/models/integrations/packagist_spec.rb b/spec/models/integrations/packagist_spec.rb index d1976e73e2e..e078debd126 100644 --- a/spec/models/integrations/packagist_spec.rb +++ b/spec/models/integrations/packagist_spec.rb @@ -26,7 +26,7 @@ RSpec.describe Integrations::Packagist do it_behaves_like Integrations::HasWebHook do let(:integration) { described_class.new(packagist_params) } - let(:hook_url) { "#{packagist_server}/api/update-package?username=#{packagist_username}&apiToken=#{packagist_token}" } + let(:hook_url) { "#{packagist_server}/api/update-package?username={username}&apiToken={token}" } end it_behaves_like Integrations::ResetSecretFields do |