diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-17 19:05:49 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-17 19:05:49 +0300 |
commit | 43a25d93ebdabea52f99b05e15b06250cd8f07d7 (patch) | |
tree | dceebdc68925362117480a5d672bcff122fb625b /spec/requests/jira_connect | |
parent | 20c84b99005abd1c82101dfeff264ac50d2df211 (diff) |
Add latest changes from gitlab-org/gitlab@16-0-stable-eev16.0.0-rc42
Diffstat (limited to 'spec/requests/jira_connect')
3 files changed, 5 insertions, 68 deletions
diff --git a/spec/requests/jira_connect/oauth_application_ids_controller_spec.rb b/spec/requests/jira_connect/oauth_application_ids_controller_spec.rb index d111edd06da..2f6113c6dd7 100644 --- a/spec/requests/jira_connect/oauth_application_ids_controller_spec.rb +++ b/spec/requests/jira_connect/oauth_application_ids_controller_spec.rb @@ -38,11 +38,7 @@ RSpec.describe JiraConnect::OauthApplicationIdsController, feature_category: :in end end - context 'on GitLab.com' do - before do - allow(Gitlab).to receive(:com?).and_return(true) - end - + context 'on SaaS', :saas do it 'renders not found' do get '/-/jira_connect/oauth_application_id' diff --git a/spec/requests/jira_connect/public_keys_controller_spec.rb b/spec/requests/jira_connect/public_keys_controller_spec.rb index 7f0262eaf65..62a81d43e65 100644 --- a/spec/requests/jira_connect/public_keys_controller_spec.rb +++ b/spec/requests/jira_connect/public_keys_controller_spec.rb @@ -5,11 +5,10 @@ require 'spec_helper' RSpec.describe JiraConnect::PublicKeysController, feature_category: :integrations do describe 'GET /-/jira_connect/public_keys/:uuid' do let(:uuid) { non_existing_record_id } - let(:public_key_storage_enabled_config) { true } + let(:public_key_storage_enabled) { true } before do - allow(Gitlab.config.jira_connect).to receive(:enable_public_keys_storage) - .and_return(public_key_storage_enabled_config) + stub_application_setting(jira_connect_public_key_storage_enabled: public_key_storage_enabled) end it 'renders 404' do @@ -30,26 +29,14 @@ RSpec.describe JiraConnect::PublicKeysController, feature_category: :integration expect(response.body).to eq(public_key.key) end - context 'when public key storage config disabled' do - let(:public_key_storage_enabled_config) { false } + context 'when public key storage setting disabled' do + let(:public_key_storage_enabled) { false } it 'renders 404' do get jira_connect_public_key_path(id: uuid) expect(response).to have_gitlab_http_status(:not_found) end - - context 'when public key storage setting is enabled' do - before do - stub_application_setting(jira_connect_public_key_storage_enabled: true) - end - - it 'renders 404' do - get jira_connect_public_key_path(id: uuid) - - expect(response).to have_gitlab_http_status(:ok) - end - end end end end diff --git a/spec/requests/jira_connect/users_controller_spec.rb b/spec/requests/jira_connect/users_controller_spec.rb deleted file mode 100644 index c02bd324708..00000000000 --- a/spec/requests/jira_connect/users_controller_spec.rb +++ /dev/null @@ -1,46 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe JiraConnect::UsersController, feature_category: :integrations do - describe 'GET /-/jira_connect/users' do - let_it_be(:user) { create(:user) } - - before do - sign_in(user) - end - - context 'with a valid host' do - let(:return_to) { 'https://testcompany.atlassian.net/plugins/servlet/ac/gitlab-jira-connect-staging.gitlab.com/gitlab-configuration' } - - it 'includes a return url' do - get '/-/jira_connect/users', params: { return_to: return_to } - - expect(response).to have_gitlab_http_status(:ok) - expect(response.body).to include('Return to GitLab') - end - end - - context 'with an invalid host' do - let(:return_to) { 'https://evil.com' } - - it 'does not include a return url' do - get '/-/jira_connect/users', params: { return_to: return_to } - - expect(response).to have_gitlab_http_status(:ok) - expect(response.body).not_to include('Return to GitLab') - end - end - - context 'with a script injected' do - let(:return_to) { 'javascript://test.atlassian.net/%250dalert(document.domain)' } - - it 'does not include a return url' do - get '/-/jira_connect/users', params: { return_to: return_to } - - expect(response).to have_gitlab_http_status(:ok) - expect(response.body).not_to include('Return to GitLab') - end - end - end -end |