Commit 595437ed authored by David Kim's avatar David Kim

Merge branch 'dblessing_fix_group_saml_specs' into 'master'

Fix Group SAML order-dependent test failures

See merge request gitlab-org/gitlab!63779
parents 7771b31b dcc2c1b4
...@@ -51,10 +51,12 @@ RSpec.describe OmniAuth::Strategies::GroupSaml, type: :strategy do ...@@ -51,10 +51,12 @@ RSpec.describe OmniAuth::Strategies::GroupSaml, type: :strategy do
describe 'POST /groups/:group_path/-/saml/callback' do describe 'POST /groups/:group_path/-/saml/callback' do
context 'with valid SAMLResponse' do context 'with valid SAMLResponse' do
before do before do
allow_any_instance_of(OneLogin::RubySaml::Response).to receive(:validate_signature) { true } allow_next_instance_of(OneLogin::RubySaml::Response) do |instance|
allow_any_instance_of(OneLogin::RubySaml::Response).to receive(:validate_session_expiration) { true } allow(instance).to receive(:validate_signature) { true }
allow_any_instance_of(OneLogin::RubySaml::Response).to receive(:validate_subject_confirmation) { true } allow(instance).to receive(:validate_session_expiration) { true }
allow_any_instance_of(OneLogin::RubySaml::Response).to receive(:validate_conditions) { true } allow(instance).to receive(:validate_subject_confirmation) { true }
allow(instance).to receive(:validate_conditions) { true }
end
end end
it 'sets the auth hash based on the response' do it 'sets the auth hash based on the response' do
...@@ -82,7 +84,9 @@ RSpec.describe OmniAuth::Strategies::GroupSaml, type: :strategy do ...@@ -82,7 +84,9 @@ RSpec.describe OmniAuth::Strategies::GroupSaml, type: :strategy do
let(:relay_state) { ::OmniAuth::Strategies::GroupSaml::VERIFY_SAML_RESPONSE } let(:relay_state) { ::OmniAuth::Strategies::GroupSaml::VERIFY_SAML_RESPONSE }
it 'stores the saml response for retrieval after redirect' do it 'stores the saml response for retrieval after redirect' do
expect_any_instance_of(::Gitlab::Auth::GroupSaml::ResponseStore).to receive(:set_raw).with(saml_response) expect_next_instance_of(::Gitlab::Auth::GroupSaml::ResponseStore) do |instance|
allow(instance).to receive(:set_raw).with(saml_response)
end
post "/groups/my-group/-/saml/callback", SAMLResponse: saml_response, RelayState: relay_state post "/groups/my-group/-/saml/callback", SAMLResponse: saml_response, RelayState: relay_state
end end
...@@ -149,7 +153,9 @@ RSpec.describe OmniAuth::Strategies::GroupSaml, type: :strategy do ...@@ -149,7 +153,9 @@ RSpec.describe OmniAuth::Strategies::GroupSaml, type: :strategy do
it "stores request ID during request phase" do it "stores request ID during request phase" do
request_id = double request_id = double
allow_any_instance_of(OneLogin::RubySaml::Authrequest).to receive(:uuid).and_return(request_id) allow_next_instance_of(OneLogin::RubySaml::Authrequest) do |instance|
allow(instance).to receive(:uuid).and_return(request_id)
end
post '/users/auth/group_saml', group_path: 'my-group' post '/users/auth/group_saml', group_path: 'my-group'
......
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