Commit f56c2191 authored by Robert Schilling's avatar Robert Schilling

Add more tests to cover all cases

parent cc18c332
...@@ -207,6 +207,18 @@ describe ApplicationSettings::UpdateService do ...@@ -207,6 +207,18 @@ describe ApplicationSettings::UpdateService do
described_class.new(application_settings, admin, { external_authorization_service_enabled: false }).execute described_class.new(application_settings, admin, { external_authorization_service_enabled: false }).execute
end end
it 'does validate labels if external authorization gets enabled ' do
expect_any_instance_of(described_class).to receive(:validate_classification_label)
described_class.new(application_settings, admin, { external_authorization_service_enabled: true }).execute
end
it 'does validate labels if external authorization is left unchanged' do
expect_any_instance_of(described_class).to receive(:validate_classification_label)
described_class.new(application_settings, admin, { external_authorization_service_default_label: 'new-label' }).execute
end
it 'does not save the settings with an error if the service denies access' do it 'does not save the settings with an error if the service denies access' do
expect(::Gitlab::ExternalAuthorization) expect(::Gitlab::ExternalAuthorization)
.to receive(:access_allowed?).with(admin, 'new-label') { false } .to receive(:access_allowed?).with(admin, 'new-label') { false }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment