diff options
Diffstat (limited to 'spec/controllers/oauth')
-rw-r--r-- | spec/controllers/oauth/applications_controller_spec.rb | 27 | ||||
-rw-r--r-- | spec/controllers/oauth/token_info_controller_spec.rb | 12 |
2 files changed, 29 insertions, 10 deletions
diff --git a/spec/controllers/oauth/applications_controller_spec.rb b/spec/controllers/oauth/applications_controller_spec.rb index 5bf3b4c48bf..9b16dc9a463 100644 --- a/spec/controllers/oauth/applications_controller_spec.rb +++ b/spec/controllers/oauth/applications_controller_spec.rb @@ -113,11 +113,30 @@ RSpec.describe Oauth::ApplicationsController do subject { post :create, params: oauth_params } - it 'creates an application' do - subject + context 'when hash_oauth_tokens flag set' do + before do + stub_feature_flags(hash_oauth_secrets: true) + end - expect(response).to have_gitlab_http_status(:found) - expect(response).to redirect_to(oauth_application_path(Doorkeeper::Application.last)) + it 'creates an application' do + subject + + expect(response).to have_gitlab_http_status(:ok) + expect(response).to render_template :show + end + end + + context 'when hash_oauth_tokens flag not set' do + before do + stub_feature_flags(hash_oauth_secrets: false) + end + + it 'creates an application' do + subject + + expect(response).to have_gitlab_http_status(:found) + expect(response).to redirect_to(oauth_application_path(Doorkeeper::Application.last)) + end end it 'redirects back to profile page if OAuth applications are disabled' do diff --git a/spec/controllers/oauth/token_info_controller_spec.rb b/spec/controllers/oauth/token_info_controller_spec.rb index b66fff4d4e9..3cd952d4935 100644 --- a/spec/controllers/oauth/token_info_controller_spec.rb +++ b/spec/controllers/oauth/token_info_controller_spec.rb @@ -24,12 +24,12 @@ RSpec.describe Oauth::TokenInfoController do expect(response).to have_gitlab_http_status(:ok) expect(Gitlab::Json.parse(response.body)).to eq( - 'scope' => %w[api], - 'scopes' => %w[api], - 'created_at' => access_token.created_at.to_i, - 'expires_in' => access_token.expires_in, - 'application' => { 'uid' => application.uid }, - 'resource_owner_id' => access_token.resource_owner_id, + 'scope' => %w[api], + 'scopes' => %w[api], + 'created_at' => access_token.created_at.to_i, + 'expires_in' => access_token.expires_in, + 'application' => { 'uid' => application.uid }, + 'resource_owner_id' => access_token.resource_owner_id, 'expires_in_seconds' => access_token.expires_in ) end |