From 0653e08efd039a5905f3fa4f6e9cef9f5d2f799c Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Mon, 20 Sep 2021 13:18:24 +0000 Subject: Add latest changes from gitlab-org/gitlab@14-3-stable-ee --- spec/requests/oauth_tokens_spec.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'spec/requests/oauth_tokens_spec.rb') diff --git a/spec/requests/oauth_tokens_spec.rb b/spec/requests/oauth_tokens_spec.rb index 6d944bbc783..fdcc76f42cc 100644 --- a/spec/requests/oauth_tokens_spec.rb +++ b/spec/requests/oauth_tokens_spec.rb @@ -55,5 +55,29 @@ RSpec.describe 'OAuth Tokens requests' do expect(json_response['access_token']).not_to be_nil end + + context 'when the application is configured to use expiring tokens' do + before do + application.update!(expire_access_tokens: true) + end + + it 'generates an access token with an expiration' do + request_access_token(user) + + expect(json_response['expires_in']).not_to be_nil + end + end + + context 'when the application is configured not to use expiring tokens' do + before do + application.update!(expire_access_tokens: false) + end + + it 'generates an access token without an expiration' do + request_access_token(user) + + expect(json_response.key?('expires_in')).to eq(false) + end + end end end -- cgit v1.2.1