summaryrefslogtreecommitdiff
path: root/qa/spec
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-20 09:24:38 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-20 09:24:38 +0000
commit898e2cc1dfa88b4ac39cb4b35011f61b37f57b51 (patch)
treec6524edb6c9a43cccf93be05c36883fde1a53ee4 /qa/spec
parentb5571e6e22cdacc81f78eff5943d68c8ba220fbb (diff)
downloadgitlab-ce-898e2cc1dfa88b4ac39cb4b35011f61b37f57b51.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa/spec')
-rw-r--r--qa/spec/runtime/application_settings_spec.rb43
-rw-r--r--qa/spec/runtime/env_spec.rb14
2 files changed, 57 insertions, 0 deletions
diff --git a/qa/spec/runtime/application_settings_spec.rb b/qa/spec/runtime/application_settings_spec.rb
new file mode 100644
index 00000000000..fce0361aee0
--- /dev/null
+++ b/qa/spec/runtime/application_settings_spec.rb
@@ -0,0 +1,43 @@
+# frozen_string_literal: true
+
+describe QA::Runtime::ApplicationSettings do
+ let(:api_client) { double('QA::Runtime::API::Client') }
+ let(:request) { Struct.new(:url).new('http://api') }
+ let(:get_response) { Struct.new(:body).new("{}") }
+
+ before do
+ allow(described_class).to receive(:api_client).and_return(api_client)
+ end
+
+ describe '.set_application_settings' do
+ it 'sets application settings' do
+ expect(QA::Runtime::API::Request)
+ .to receive(:new)
+ .with(api_client, '/application/settings')
+ .and_return(request)
+
+ expect(described_class)
+ .to receive(:put)
+ .with(request.url, { allow_local_requests_from_web_hooks_and_services: true })
+ .and_return(Struct.new(:code).new(200))
+
+ subject.set_application_settings(allow_local_requests_from_web_hooks_and_services: true)
+ end
+ end
+
+ describe '.get_application_settings' do
+ it 'gets application settings' do
+ expect(QA::Runtime::API::Request)
+ .to receive(:new)
+ .with(api_client, '/application/settings')
+ .and_return(request)
+
+ expect(described_class)
+ .to receive(:get)
+ .with(request.url)
+ .and_return(get_response)
+
+ subject.get_application_settings
+ end
+ end
+end
diff --git a/qa/spec/runtime/env_spec.rb b/qa/spec/runtime/env_spec.rb
index 340831aa06d..0a0bf33a726 100644
--- a/qa/spec/runtime/env_spec.rb
+++ b/qa/spec/runtime/env_spec.rb
@@ -230,6 +230,20 @@ describe QA::Runtime::Env do
end
end
+ describe '.require_admin_access_token!' do
+ it 'raises ArgumentError if GITLAB_QA_ADMIN_ACCESS_TOKEN is not specified' do
+ stub_env('GITLAB_QA_ADMIN_ACCESS_TOKEN', nil)
+
+ expect { described_class.require_admin_access_token! }.to raise_error(ArgumentError)
+ end
+
+ it 'does not raise exception if GITLAB_QA_ADMIN_ACCESS_TOKEN is specified' do
+ stub_env('GITLAB_QA_ADMIN_ACCESS_TOKEN', 'foobar123')
+
+ expect { described_class.require_admin_access_token! }.not_to raise_error
+ end
+ end
+
describe '.log_destination' do
it 'returns $stdout if QA_LOG_PATH is not defined' do
stub_env('QA_LOG_PATH', nil)