mirror of
https://github.com/internetee/registry.git
synced 2025-07-28 05:26:17 +02:00
test refactoring
This commit is contained in:
parent
4567e56457
commit
72f184d9b0
7 changed files with 65 additions and 73 deletions
|
@ -4,6 +4,8 @@ class AdminAreaRegistrarsIntegrationTest < ActionDispatch::IntegrationTest
|
|||
include Devise::Test::IntegrationHelpers
|
||||
|
||||
setup do
|
||||
ENV['registry_demo_registrar_api_user_url'] = 'http://registry.test:3000/api/v1/accreditation_center/show_api_user'
|
||||
ENV['registry_demo_registrar_port'] = '3000'
|
||||
@api_user = users(:api_bestnames)
|
||||
sign_in users(:admin)
|
||||
end
|
||||
|
@ -22,14 +24,16 @@ class AdminAreaRegistrarsIntegrationTest < ActionDispatch::IntegrationTest
|
|||
assert_equal api_user.accreditation_date, date
|
||||
|
||||
# api_v1_accreditation_center_show_api_user_url
|
||||
stub_request(:get, "http://registry.test:3000/api/v1/accreditation_center/show_api_user?identity_code=#{@api_user.identity_code}&username=#{@api_user.username}").
|
||||
with(
|
||||
stub_request(:get, "http://registry.test:3000/api/v1/accreditation_center/show_api_user?username=#{@api_user.username}&identity_code=#{@api_user.identity_code}")
|
||||
.with(
|
||||
headers: {
|
||||
'Accept'=>'*/*',
|
||||
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
||||
'User-Agent'=>'Ruby'
|
||||
}).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 }
|
||||
'Accept' => '*/*',
|
||||
'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
||||
'User-Agent' => 'Ruby'
|
||||
}
|
||||
)
|
||||
.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 }
|
||||
@api_user.reload
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue