mirror of
https://github.com/internetee/registry.git
synced 2025-07-29 14:06:21 +02:00
Corrected integration test
This commit is contained in:
parent
52b3b3a6cf
commit
597766dba0
1 changed files with 23 additions and 1 deletions
|
@ -18,7 +18,12 @@ class ReppV1RegistrarAuthTaraCallbackTest < ActionDispatch::IntegrationTest
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Repp::V1::BaseController.stub_any_instance(:webclient_request?, true) do
|
||||||
|
Repp::V1::BaseController.stub_any_instance(:validate_webclient_ca, true) do
|
||||||
post '/repp/v1/registrar/auth/tara_callback', headers: @auth_headers, params: request_body
|
post '/repp/v1/registrar/auth/tara_callback', headers: @auth_headers, params: request_body
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
json = JSON.parse(response.body, symbolize_names: true)
|
json = JSON.parse(response.body, symbolize_names: true)
|
||||||
|
|
||||||
assert_response :ok
|
assert_response :ok
|
||||||
|
@ -43,4 +48,21 @@ class ReppV1RegistrarAuthTaraCallbackTest < ActionDispatch::IntegrationTest
|
||||||
assert_response :unauthorized
|
assert_response :unauthorized
|
||||||
assert_equal 'No such user', json[:message]
|
assert_equal 'No such user', json[:message]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_invalidates_user_if_not_webclient_request
|
||||||
|
request_body = {
|
||||||
|
auth: {
|
||||||
|
uid: 'EE1234',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
Repp::V1::BaseController.stub_any_instance(:webclient_request?, false) do
|
||||||
|
post '/repp/v1/registrar/auth/tara_callback', headers: @auth_headers, params: request_body
|
||||||
|
end
|
||||||
|
|
||||||
|
json = JSON.parse(response.body, symbolize_names: true)
|
||||||
|
|
||||||
|
assert_response :unauthorized
|
||||||
|
assert_equal 'No such user', json[:message]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue