2020-11-24 15:15:51 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2023-03-04 22:38:38 +05:30
|
|
|
RSpec.describe 'JIRA OAuth Provider', feature_category: :integrations do
|
2020-11-24 15:15:51 +05:30
|
|
|
describe 'JIRA DVCS OAuth Authorization' do
|
2023-07-09 08:55:56 +05:30
|
|
|
let_it_be(:application) do
|
|
|
|
create(:oauth_application, redirect_uri: oauth_jira_dvcs_callback_url, scopes: 'read_user')
|
|
|
|
end
|
|
|
|
|
|
|
|
let(:authorize_path) do
|
|
|
|
oauth_jira_dvcs_authorize_path(client_id: application.uid,
|
|
|
|
redirect_uri: oauth_jira_dvcs_callback_url,
|
|
|
|
response_type: 'code',
|
|
|
|
state: 'my_state',
|
|
|
|
scope: 'read_user')
|
|
|
|
end
|
2020-11-24 15:15:51 +05:30
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in(user)
|
2023-07-09 08:55:56 +05:30
|
|
|
end
|
2020-11-24 15:15:51 +05:30
|
|
|
|
2023-07-09 08:55:56 +05:30
|
|
|
it_behaves_like 'Secure OAuth Authorizations' do
|
|
|
|
before do
|
|
|
|
visit authorize_path
|
|
|
|
end
|
2020-11-24 15:15:51 +05:30
|
|
|
end
|
|
|
|
|
2023-07-09 08:55:56 +05:30
|
|
|
context 'when the flag is disabled' do
|
|
|
|
let_it_be(:user) { create(:user) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
stub_feature_flags(jira_dvcs_end_of_life_amnesty: false)
|
|
|
|
visit authorize_path
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'presents as an endpoint that does not exist' do
|
|
|
|
expect(page).to have_gitlab_http_status(:not_found)
|
|
|
|
end
|
|
|
|
end
|
2020-11-24 15:15:51 +05:30
|
|
|
end
|
|
|
|
end
|