mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-13 00:24:42 +08:00
Remove test for old api token endpoint [SCI-2515]
This commit is contained in:
parent
ecde634a2c
commit
8df6ebb5f2
1 changed files with 0 additions and 41 deletions
|
@ -21,45 +21,4 @@ describe Api::ApiController, type: :controller do
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'Post #authenticate' do
|
|
||||||
let(:user) { create(:user) }
|
|
||||||
|
|
||||||
context 'When valid request' do
|
|
||||||
before do
|
|
||||||
post :authenticate, params: { email: user.email,
|
|
||||||
password: user.password,
|
|
||||||
grant_type: 'password' }
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'Returns HTTP success' do
|
|
||||||
expect(response).to have_http_status(200)
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'Returns valid JWT token' do
|
|
||||||
token = nil
|
|
||||||
expect { token = json['access_token'] }.not_to raise_exception
|
|
||||||
user_id = nil
|
|
||||||
expect { user_id = decode_token(token) }.not_to raise_exception
|
|
||||||
expect(user_id).to eq(user.id)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'When invalid password in request' do
|
|
||||||
it 'Returns HTTP error' do
|
|
||||||
post :authenticate, params: { email: user.email,
|
|
||||||
password: 'wrong_password',
|
|
||||||
grant_type: 'password' }
|
|
||||||
expect(response).to have_http_status(400)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'When no grant_type in request' do
|
|
||||||
it 'Returns HTTP error' do
|
|
||||||
post :authenticate, params: { email: user.email,
|
|
||||||
password: user.password }
|
|
||||||
expect(response).to have_http_status(400)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue