mirror of
https://github.com/internetee/registry.git
synced 2025-07-22 18:56:05 +02:00
REPP: Domain transfer info test
This commit is contained in:
parent
2a1967918c
commit
9a36b0403c
2 changed files with 41 additions and 1 deletions
|
@ -90,7 +90,7 @@ module Repp
|
||||||
|
|
||||||
return if @domain.transfer_code.eql?(request.headers['Auth-Code'])
|
return if @domain.transfer_code.eql?(request.headers['Auth-Code'])
|
||||||
|
|
||||||
@epp_errors << { code: '401', msg: I18n.t('errors.messages.epp_authorization_error') }
|
@epp_errors << { code: 2202, msg: I18n.t('errors.messages.epp_authorization_error') }
|
||||||
handle_errors
|
handle_errors
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
40
test/integration/repp/v1/domains/transfer_info_test.rb
Normal file
40
test/integration/repp/v1/domains/transfer_info_test.rb
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class ReppV1DomainsTransferInfoTest < ActionDispatch::IntegrationTest
|
||||||
|
def setup
|
||||||
|
@user = users(:api_bestnames)
|
||||||
|
token = Base64.encode64("#{@user.username}:#{@user.plain_text_password}")
|
||||||
|
token = "Basic #{token}"
|
||||||
|
@domain = domains(:shop)
|
||||||
|
@auth_headers = { 'Authorization' => token }
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_can_query_domain_info
|
||||||
|
headers = @auth_headers
|
||||||
|
headers['Auth-Code'] = @domain.transfer_code
|
||||||
|
|
||||||
|
get "/repp/v1/domains/#{@domain.name}/transfer_info", headers: @auth_headers
|
||||||
|
json = JSON.parse(response.body, symbolize_names: true)
|
||||||
|
|
||||||
|
assert_response :ok
|
||||||
|
assert_equal 1000, json[:code]
|
||||||
|
assert_equal 'Command completed successfully', json[:message]
|
||||||
|
assert_equal @domain.name, json[:data][:domain]
|
||||||
|
assert json[:data][:registrant].present?
|
||||||
|
assert json[:data][:admin_contacts].present?
|
||||||
|
assert json[:data][:tech_contacts].present?
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_respects_domain_authorization_code
|
||||||
|
headers = @auth_headers
|
||||||
|
headers['Auth-Code'] = 'jhfgifhdg'
|
||||||
|
|
||||||
|
get "/repp/v1/domains/#{@domain.name}/transfer_info", headers: @auth_headers
|
||||||
|
json = JSON.parse(response.body, symbolize_names: true)
|
||||||
|
|
||||||
|
assert_response :bad_request
|
||||||
|
assert_equal 2202, json[:code]
|
||||||
|
assert_equal 'Authorization error', json[:message]
|
||||||
|
assert_empty json[:data]
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Add a link
Reference in a new issue