diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-03 21:13:40 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-03 21:13:40 +0300 |
commit | bbc36645d34c557df40d031a1a41fbd05e491644 (patch) | |
tree | 55529c6e93d72f7e35e78488a397f50098f137a5 /spec/controllers | |
parent | 70a50740a20ab0027e0490487f6244f5ec961eee (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/jira_connect/app_descriptor_controller_spec.rb | 12 | ||||
-rw-r--r-- | spec/controllers/jira_connect/events_controller_spec.rb | 75 |
2 files changed, 0 insertions, 87 deletions
diff --git a/spec/controllers/jira_connect/app_descriptor_controller_spec.rb b/spec/controllers/jira_connect/app_descriptor_controller_spec.rb index 9d890efdd33..4f8b2b90637 100644 --- a/spec/controllers/jira_connect/app_descriptor_controller_spec.rb +++ b/spec/controllers/jira_connect/app_descriptor_controller_spec.rb @@ -90,17 +90,5 @@ RSpec.describe JiraConnect::AppDescriptorController do ) ) end - - context 'when jira_connect_asymmetric_jwt is disabled' do - before do - stub_feature_flags(jira_connect_asymmetric_jwt: false) - end - - specify do - get :show - - expect(json_response).to include('apiMigrations' => include('signed-install' => false)) - end - end end end diff --git a/spec/controllers/jira_connect/events_controller_spec.rb b/spec/controllers/jira_connect/events_controller_spec.rb index 78bd0dc8318..2a70a2ea683 100644 --- a/spec/controllers/jira_connect/events_controller_spec.rb +++ b/spec/controllers/jira_connect/events_controller_spec.rb @@ -77,18 +77,6 @@ RSpec.describe JiraConnect::EventsController do expect(installation.base_url).to eq('https://test.atlassian.net') end - context 'when jira_connect_asymmetric_jwt is disabled' do - before do - stub_feature_flags(jira_connect_asymmetric_jwt: false) - end - - it 'saves the jira installation data without JWT validation' do - expect(Atlassian::JiraConnect::AsymmetricJwt).not_to receive(:new) - - expect { subject }.to change { JiraConnectInstallation.count }.by(1) - end - end - context 'when it is a version update and shared_secret is not sent' do let(:params) do { @@ -110,22 +98,6 @@ RSpec.describe JiraConnect::EventsController do expect { subject }.not_to change { JiraConnectInstallation.count } expect(response).to have_gitlab_http_status(:ok) end - - context 'when jira_connect_asymmetric_jwt is disabled' do - before do - stub_feature_flags(jira_connect_asymmetric_jwt: false) - end - - it 'decodes the JWT token in authorization header and returns 200 without creating a new installation' do - request.headers["Authorization"] = "Bearer #{Atlassian::Jwt.encode({ iss: client_key }, shared_secret)}" - - expect(Atlassian::JiraConnect::AsymmetricJwt).not_to receive(:new) - - expect { subject }.not_to change { JiraConnectInstallation.count } - - expect(response).to have_gitlab_http_status(:ok) - end - end end end end @@ -153,23 +125,6 @@ RSpec.describe JiraConnect::EventsController do it 'does not delete the installation' do expect { post_uninstalled }.not_to change { JiraConnectInstallation.count } end - - context 'when jira_connect_asymmetric_jwt is disabled' do - before do - stub_feature_flags(jira_connect_asymmetric_jwt: false) - request.headers['Authorization'] = 'JWT invalid token' - end - - it 'returns 403' do - post_uninstalled - - expect(response).to have_gitlab_http_status(:forbidden) - end - - it 'does not delete the installation' do - expect { post_uninstalled }.not_to change { JiraConnectInstallation.count } - end - end end context 'when JWT is valid' do @@ -197,36 +152,6 @@ RSpec.describe JiraConnect::EventsController do expect(response).to have_gitlab_http_status(:unprocessable_entity) end - - context 'when jira_connect_asymmetric_jwt is disabled' do - before do - stub_feature_flags(jira_connect_asymmetric_jwt: false) - - request.headers['Authorization'] = "JWT #{Atlassian::Jwt.encode({ iss: installation.client_key, qsh: qsh }, installation.shared_secret)}" - end - - let(:qsh) { Atlassian::Jwt.create_query_string_hash('https://gitlab.test/events/uninstalled', 'POST', 'https://gitlab.test') } - - it 'calls the DestroyService and returns ok in case of success' do - expect_next_instance_of(JiraConnectInstallations::DestroyService, installation, jira_base_path, jira_event_path) do |destroy_service| - expect(destroy_service).to receive(:execute).and_return(true) - end - - post_uninstalled - - expect(response).to have_gitlab_http_status(:ok) - end - - it 'calls the DestroyService and returns unprocessable_entity in case of failure' do - expect_next_instance_of(JiraConnectInstallations::DestroyService, installation, jira_base_path, jira_event_path) do |destroy_service| - expect(destroy_service).to receive(:execute).and_return(false) - end - - post_uninstalled - - expect(response).to have_gitlab_http_status(:unprocessable_entity) - end - end end end end |