mirror of
https://github.com/internetee/registry.git
synced 2025-07-28 13:36:15 +02:00
made crutch for tests
This commit is contained in:
parent
7ec9253fc9
commit
97876ab1c1
3 changed files with 34 additions and 35 deletions
|
@ -50,7 +50,7 @@ module Admin
|
||||||
def set_test_date_to_api_user
|
def set_test_date_to_api_user
|
||||||
user_api = User.find(params[:user_api_id])
|
user_api = User.find(params[:user_api_id])
|
||||||
|
|
||||||
uri = URI.parse(ENV['registry_demo_registrar_api_user_url'] + "?username=#{user_api.username}&identity_code=#{user_api.identity_code}")
|
uri = URI.parse((ENV['registry_demo_registrar_api_user_url'] || 'testapi.test') + "?username=#{user_api.username}&identity_code=#{user_api.identity_code}")
|
||||||
|
|
||||||
response = base_get_request(uri: uri, port: ENV['registry_demo_registrar_port'])
|
response = base_get_request(uri: uri, port: ENV['registry_demo_registrar_port'])
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ module Admin
|
||||||
def set_test_date
|
def set_test_date
|
||||||
registrar = Registrar.find(params[:registrar_id])
|
registrar = Registrar.find(params[:registrar_id])
|
||||||
|
|
||||||
uri = URI.parse(ENV['registry_demo_registrar_results_url'] + "?registrar_name=#{registrar.name}")
|
uri = URI.parse((ENV['registry_demo_registrar_results_url'] || 'testapi.test') + "?registrar_name=#{registrar.name}")
|
||||||
|
|
||||||
response = base_get_request(uri: uri, port: ENV['registry_demo_registrar_port'])
|
response = base_get_request(uri: uri, port: ENV['registry_demo_registrar_port'])
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,8 @@ class AdminAreaRegistrarsIntegrationTest < ActionDispatch::IntegrationTest
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_set_test_date_to_api_user
|
def test_set_test_date_to_api_user
|
||||||
|
# ENV['registry_demo_registrar_api_user_url'] = 'http://testapi.test'
|
||||||
|
|
||||||
date = Time.zone.now - 10.minutes
|
date = Time.zone.now - 10.minutes
|
||||||
|
|
||||||
api_user = @api_user.dup
|
api_user = @api_user.dup
|
||||||
|
@ -27,12 +29,9 @@ class AdminAreaRegistrarsIntegrationTest < ActionDispatch::IntegrationTest
|
||||||
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
||||||
'User-Agent'=>'Ruby'
|
'User-Agent'=>'Ruby'
|
||||||
}).to_return(status: 200, body: { code: 200, user_api: api_user }.to_json, headers: {})
|
}).to_return(status: 200, body: { code: 200, user_api: api_user }.to_json, headers: {})
|
||||||
|
|
||||||
|
|
||||||
post set_test_date_to_api_user_admin_registrars_path, params: { user_api_id: @api_user.id }, headers: { "HTTP_REFERER" => root_path }
|
post set_test_date_to_api_user_admin_registrars_path, params: { user_api_id: @api_user.id }, headers: { "HTTP_REFERER" => root_path }
|
||||||
@api_user.reload
|
@api_user.reload
|
||||||
|
|
||||||
assert_equal @api_user.accreditation_date.to_date, api_user.accreditation_date.to_date
|
assert_equal @api_user.accreditation_date.to_date, api_user.accreditation_date.to_date
|
||||||
assert_equal @api_user.accreditation_expire_date.to_date, api_user.accreditation_expire_date.to_date
|
assert_equal @api_user.accreditation_expire_date.to_date, api_user.accreditation_expire_date.to_date
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue