summaryrefslogtreecommitdiff
path: root/spec/requests/api/settings_spec.rb
diff options
context:
space:
mode:
authorImre Farkas <ifarkas@gitlab.com>2019-04-09 15:38:58 +0000
committerAndreas Brandl <abrandl@gitlab.com>2019-04-09 15:38:58 +0000
commit9bc5ed14fe97fe63cd5be30c013c6af978715621 (patch)
tree74e1548a29b4683e94720b346a4fc41a068b2583 /spec/requests/api/settings_spec.rb
parenta6218f1bcd78f656d57330e764d3f98e1fb1f3f3 (diff)
downloadgitlab-ce-9bc5ed14fe97fe63cd5be30c013c6af978715621.tar.gz
Move Contribution Analytics related spec in spec/features/groups/group_page_with_external_authorization_service_spec to EE
Diffstat (limited to 'spec/requests/api/settings_spec.rb')
-rw-r--r--spec/requests/api/settings_spec.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/requests/api/settings_spec.rb b/spec/requests/api/settings_spec.rb
index f869325e892..527ab1cfb66 100644
--- a/spec/requests/api/settings_spec.rb
+++ b/spec/requests/api/settings_spec.rb
@@ -116,6 +116,39 @@ describe API::Settings, 'Settings' do
expect(json_response['performance_bar_allowed_group_id']).to be_nil
end
+ context 'external policy classification settings' do
+ let(:settings) do
+ {
+ external_authorization_service_enabled: true,
+ external_authorization_service_url: 'https://custom.service/',
+ external_authorization_service_default_label: 'default',
+ external_authorization_service_timeout: 9.99,
+ external_auth_client_cert: File.read('spec/fixtures/passphrase_x509_certificate.crt'),
+ external_auth_client_key: File.read('spec/fixtures/passphrase_x509_certificate_pk.key'),
+ external_auth_client_key_pass: "5iveL!fe"
+ }
+ end
+ let(:attribute_names) { settings.keys.map(&:to_s) }
+
+ it 'includes the attributes in the API' do
+ get api("/application/settings", admin)
+
+ expect(response).to have_gitlab_http_status(200)
+ attribute_names.each do |attribute|
+ expect(json_response.keys).to include(attribute)
+ end
+ end
+
+ it 'allows updating the settings' do
+ put api("/application/settings", admin), params: settings
+
+ expect(response).to have_gitlab_http_status(200)
+ settings.each do |attribute, value|
+ expect(ApplicationSetting.current.public_send(attribute)).to eq(value)
+ end
+ end
+ end
+
context "missing plantuml_url value when plantuml_enabled is true" do
it "returns a blank parameter error message" do
put api("/application/settings", admin), params: { plantuml_enabled: true }