Commit 91e2fdf5 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'bvl-fix-external-auth-license-check' into 'master'

Fix crash when checking external authorization license

Closes #5203

See merge request gitlab-org/gitlab-ee!4919
parents 0f8e3362 d3447d6c
...@@ -489,7 +489,7 @@ module EE ...@@ -489,7 +489,7 @@ module EE
end end
def external_authorization_classification_label def external_authorization_classification_label
return nil unless feature_available?(:external_authorization_service) return nil unless License.feature_available?(:external_authorization_service)
super || ::Gitlab::CurrentSettings.current_application_settings super || ::Gitlab::CurrentSettings.current_application_settings
.external_authorization_service_default_label .external_authorization_service_default_label
......
...@@ -1292,6 +1292,14 @@ describe Project do ...@@ -1292,6 +1292,14 @@ describe Project do
expect(project.external_authorization_classification_label) expect(project.external_authorization_classification_label)
.to eq('hello') .to eq('hello')
end end
it 'does not break when not stubbing the license check' do
enable_external_authorization_service
enable_namespace_license_check!
project = build(:project)
expect { project.external_authorization_classification_label }.not_to raise_error
end
end end
describe '#user_can_push_to_empty_repo?' do describe '#user_can_push_to_empty_repo?' do
......
...@@ -7,7 +7,7 @@ module EE ...@@ -7,7 +7,7 @@ module EE
# stub_licensed_features(geo: true, deploy_board: false) # stub_licensed_features(geo: true, deploy_board: false)
# #
# This enables `geo` and disables `deploy_board` features for a spec. # This enables `geo` and disables `deploy_board` features for a spec.
# Other features are still enabled/disabled as defined in the licence. # Other features are still enabled/disabled as defined in the license.
def stub_licensed_features(features) def stub_licensed_features(features)
allow(License).to receive(:feature_available?).and_call_original allow(License).to receive(:feature_available?).and_call_original
......
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