API de comptabilité horaire.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

tokens_controller_test.rb 579B

1234567891011121314151617181920
  1. require "test_helper"
  2. class Api::V1::TokensControllerTest < ActionDispatch::IntegrationTest
  3. setup do
  4. @user = users(:one)
  5. end
  6. test 'should get JWT token' do
  7. post api_v1_tokens_url, params: { user: { email: @user.email, password: 'g00d_pa$$' } }, as: :json
  8. assert_response :success
  9. json_response = JSON.parse(response.body)
  10. assert_not_nil json_response['token']
  11. end
  12. test 'should not get JWT token' do
  13. post api_v1_tokens_url, params: { user: { email: @user.email, password: 'b@d_pa$$' } }, as: :json
  14. assert_response :unauthorized
  15. end
  16. end