summaryrefslogtreecommitdiff
path: root/spec/models/application_setting_spec.rb
diff options
context:
space:
mode:
authorAndreas Brandl <abrandl@gitlab.com>2019-04-05 13:02:56 +0000
committerAndreas Brandl <abrandl@gitlab.com>2019-04-05 13:02:56 +0000
commit46b1b9c1d61c269588bd3cd4203420608ddd7f0b (patch)
treea877f5366d3367e1264e96f3f5e8a4b23bdbd62a /spec/models/application_setting_spec.rb
parent7a48a06cf3b454021aa466464686fee8c82d6862 (diff)
downloadgitlab-ce-46b1b9c1d61c269588bd3cd4203420608ddd7f0b.tar.gz
Revert "Merge branch 'if-57131-external_auth_to_ce' into 'master'"
This reverts merge request !26823
Diffstat (limited to 'spec/models/application_setting_spec.rb')
-rw-r--r--spec/models/application_setting_spec.rb48
1 files changed, 1 insertions, 47 deletions
diff --git a/spec/models/application_setting_spec.rb b/spec/models/application_setting_spec.rb
index c7d7dbac736..c81572d739e 100644
--- a/spec/models/application_setting_spec.rb
+++ b/spec/models/application_setting_spec.rb
@@ -3,7 +3,7 @@
require 'spec_helper'
describe ApplicationSetting do
- subject(:setting) { described_class.create_from_defaults }
+ let(:setting) { described_class.create_from_defaults }
it { include(CacheableAttributes) }
it { include(ApplicationSettingImplementation) }
@@ -284,52 +284,6 @@ describe ApplicationSetting do
expect(subject).to be_valid
end
end
-
- describe 'when external authorization service is enabled' do
- before do
- setting.external_authorization_service_enabled = true
- end
-
- it { is_expected.not_to allow_value('not a URL').for(:external_authorization_service_url) }
- it { is_expected.to allow_value('https://example.com').for(:external_authorization_service_url) }
- it { is_expected.to allow_value('').for(:external_authorization_service_url) }
- it { is_expected.not_to allow_value(nil).for(:external_authorization_service_default_label) }
- it { is_expected.not_to allow_value(11).for(:external_authorization_service_timeout) }
- it { is_expected.not_to allow_value(0).for(:external_authorization_service_timeout) }
- it { is_expected.not_to allow_value('not a certificate').for(:external_auth_client_cert) }
- it { is_expected.to allow_value('').for(:external_auth_client_cert) }
- it { is_expected.to allow_value('').for(:external_auth_client_key) }
-
- context 'when setting a valid client certificate for external authorization' do
- let(:certificate_data) { File.read('spec/fixtures/passphrase_x509_certificate.crt') }
-
- before do
- setting.external_auth_client_cert = certificate_data
- end
-
- it 'requires a valid client key when a certificate is set' do
- expect(setting).not_to allow_value('fefefe').for(:external_auth_client_key)
- end
-
- it 'requires a matching certificate' do
- other_private_key = File.read('spec/fixtures/x509_certificate_pk.key')
-
- expect(setting).not_to allow_value(other_private_key).for(:external_auth_client_key)
- end
-
- it 'the credentials are valid when the private key can be read and matches the certificate' do
- tls_attributes = [:external_auth_client_key_pass,
- :external_auth_client_key,
- :external_auth_client_cert]
- setting.external_auth_client_key = File.read('spec/fixtures/passphrase_x509_certificate_pk.key')
- setting.external_auth_client_key_pass = '5iveL!fe'
-
- setting.validate
-
- expect(setting.errors).not_to include(*tls_attributes)
- end
- end
- end
end
context 'restrict creating duplicates' do