mirror of
https://github.com/internetee/registry.git
synced 2025-07-27 21:16:12 +02:00
test refactoring
This commit is contained in:
parent
4567e56457
commit
72f184d9b0
7 changed files with 65 additions and 73 deletions
|
@ -17,8 +17,7 @@ module Admin
|
|||
|
||||
if @api_user.valid?
|
||||
@api_user.save!
|
||||
redirect_to admin_registrar_api_user_path(@api_user.registrar, @api_user),
|
||||
notice: t('.created')
|
||||
redirect_to admin_registrar_api_user_path(@api_user.registrar, @api_user), notice: t('.created')
|
||||
else
|
||||
render 'new'
|
||||
end
|
||||
|
@ -35,8 +34,7 @@ module Admin
|
|||
|
||||
if @api_user.valid?
|
||||
@api_user.save!
|
||||
redirect_to admin_registrar_api_user_path(@api_user.registrar, @api_user),
|
||||
notice: t('.updated')
|
||||
redirect_to admin_registrar_api_user_path(@api_user.registrar, @api_user), notice: t('.updated')
|
||||
else
|
||||
render 'edit'
|
||||
end
|
||||
|
@ -50,7 +48,7 @@ module Admin
|
|||
def set_test_date_to_api_user
|
||||
user_api = User.find(params[:user_api_id])
|
||||
|
||||
uri = URI.parse((ENV['registry_demo_registrar_api_user_url'] || 'http://testapi.test') + "?username=#{user_api.username}&identity_code=#{user_api.identity_code}")
|
||||
uri = URI.parse((ENV['registry_demo_registrar_api_user_url']) + "?username=#{user_api.username}&identity_code=#{user_api.identity_code}")
|
||||
|
||||
response = base_get_request(uri: uri, port: ENV['registry_demo_registrar_port'])
|
||||
|
||||
|
@ -58,9 +56,8 @@ module Admin
|
|||
result = JSON.parse(response.body)
|
||||
demo_user_api = result['user_api']
|
||||
|
||||
Actions::RecordDateOfTest.record_result_to_api_user(
|
||||
api_user:user_api,
|
||||
date: demo_user_api['accreditation_date']) unless demo_user_api.empty?
|
||||
Actions::RecordDateOfTest.record_result_to_api_user(api_user:user_api,
|
||||
date: demo_user_api['accreditation_date']) unless demo_user_api.empty?
|
||||
return redirect_to request.referrer, notice: 'User Api found'
|
||||
else
|
||||
return redirect_to request.referrer, notice: 'User Api no found or not accriditated yet'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue