2020-05-11 17:37:22 +00:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe 'Super Admin access tokens API', type: :request do
|
|
|
|
let(:super_admin) { create(:super_admin) }
|
2021-06-07 11:56:08 +00:00
|
|
|
let!(:platform_app) { create(:platform_app) }
|
2020-05-11 17:37:22 +00:00
|
|
|
|
|
|
|
describe 'GET /super_admin/access_tokens' do
|
|
|
|
context 'when it is an unauthenticated super admin' do
|
|
|
|
it 'returns unauthorized' do
|
|
|
|
get '/super_admin/'
|
|
|
|
expect(response).to have_http_status(:redirect)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when it is an authenticated super admin' do
|
|
|
|
it 'shows the list of access tokens' do
|
2022-01-26 00:58:49 +00:00
|
|
|
sign_in(super_admin, scope: :super_admin)
|
2020-05-11 17:37:22 +00:00
|
|
|
get '/super_admin/access_tokens'
|
|
|
|
expect(response).to have_http_status(:success)
|
2021-06-07 11:56:08 +00:00
|
|
|
expect(response.body).to include(platform_app.access_token.token)
|
2020-05-11 17:37:22 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|