diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 10:00:54 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 10:00:54 +0000 |
commit | 3cccd102ba543e02725d247893729e5c73b38295 (patch) | |
tree | f36a04ec38517f5deaaacb5acc7d949688d1e187 /spec/controllers/oauth/jira/authorizations_controller_spec.rb | |
parent | 205943281328046ef7b4528031b90fbda70c75ac (diff) | |
download | gitlab-ce-3cccd102ba543e02725d247893729e5c73b38295.tar.gz |
Add latest changes from gitlab-org/gitlab@14-10-stable-eev14.10.0-rc42
Diffstat (limited to 'spec/controllers/oauth/jira/authorizations_controller_spec.rb')
-rw-r--r-- | spec/controllers/oauth/jira/authorizations_controller_spec.rb | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/spec/controllers/oauth/jira/authorizations_controller_spec.rb b/spec/controllers/oauth/jira/authorizations_controller_spec.rb deleted file mode 100644 index f4a335b30f4..00000000000 --- a/spec/controllers/oauth/jira/authorizations_controller_spec.rb +++ /dev/null @@ -1,55 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Oauth::Jira::AuthorizationsController do - describe 'GET new' do - it 'redirects to OAuth authorization with correct params' do - get :new, params: { client_id: 'client-123', scope: 'foo', redirect_uri: 'http://example.com/' } - - expect(response).to redirect_to(oauth_authorization_url(client_id: 'client-123', - response_type: 'code', - scope: 'foo', - redirect_uri: oauth_jira_callback_url)) - end - - it 'replaces the GitHub "repo" scope with "api"' do - get :new, params: { client_id: 'client-123', scope: 'repo', redirect_uri: 'http://example.com/' } - - expect(response).to redirect_to(oauth_authorization_url(client_id: 'client-123', - response_type: 'code', - scope: 'api', - redirect_uri: oauth_jira_callback_url)) - end - end - - describe 'GET callback' do - it 'redirects to redirect_uri on session with code param' do - session['redirect_uri'] = 'http://example.com' - - get :callback, params: { code: 'hash-123' } - - expect(response).to redirect_to('http://example.com?code=hash-123') - end - - it 'redirects to redirect_uri on session with code param preserving existing query' do - session['redirect_uri'] = 'http://example.com?foo=bar' - - get :callback, params: { code: 'hash-123' } - - expect(response).to redirect_to('http://example.com?foo=bar&code=hash-123') - end - end - - describe 'POST access_token' do - it 'returns oauth params in a format Jira expects' do - expect_any_instance_of(Doorkeeper::Request::AuthorizationCode).to receive(:authorize) do - double(status: :ok, body: { 'access_token' => 'fake-123', 'scope' => 'foo', 'token_type' => 'bar' }) - end - - post :access_token, params: { code: 'code-123', client_id: 'client-123', client_secret: 'secret-123' } - - expect(response.body).to eq('access_token=fake-123&scope=foo&token_type=bar') - end - end -end |