mirror of
https://github.com/internetee/registry.git
synced 2025-06-09 22:24:47 +02:00
Implement the basic interface for the Authentication endpoint
* Handle errors as 422 * Require parameters through strong_parameters * Use a custom rescue_from
This commit is contained in:
parent
1c6b838b2b
commit
dad57ba528
4 changed files with 35 additions and 11 deletions
|
@ -28,6 +28,17 @@ class RegistrantApiAuthenticationTest < ApplicationSystemTestCase
|
|||
end
|
||||
|
||||
def test_request_returns_existing_user
|
||||
assert_no_changes User.count do
|
||||
post '/api/v1/registrant/auth/eid', @user_hash
|
||||
end
|
||||
end
|
||||
|
||||
def test_request_documented_parameters_are_required
|
||||
params = { foo: :bar, test: :test }
|
||||
|
||||
post '/api/v1/registrant/auth/eid', params
|
||||
json = JSON.parse(response.body, symbolize_names: true)
|
||||
assert_equal({errors: [{ident: ['parameter is required']}]}, json)
|
||||
assert_equal(422, response.status)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue