mirror of
https://github.com/internetee/registry.git
synced 2025-06-08 13:44:47 +02:00
REPP: Domain registrant change test
This commit is contained in:
parent
92db43db18
commit
1461d2a566
6 changed files with 89 additions and 5 deletions
85
test/integration/repp/v1/domains/update_test.rb
Normal file
85
test/integration/repp/v1/domains/update_test.rb
Normal file
|
@ -0,0 +1,85 @@
|
|||
require 'test_helper'
|
||||
|
||||
class ReppV1DomainsCreateTest < ActionDispatch::IntegrationTest
|
||||
def setup
|
||||
@user = users(:api_bestnames)
|
||||
@domain = domains(:shop)
|
||||
token = Base64.encode64("#{@user.username}:#{@user.plain_text_password}")
|
||||
token = "Basic #{token}"
|
||||
|
||||
@auth_headers = { 'Authorization' => token }
|
||||
end
|
||||
|
||||
def test_updates_transfer_code_for_domain
|
||||
@auth_headers['Content-Type'] = 'application/json'
|
||||
new_auth_code = 'aisdcbkabcsdnc'
|
||||
|
||||
payload = {
|
||||
domain: {
|
||||
auth_code: new_auth_code
|
||||
}
|
||||
}
|
||||
|
||||
put "/repp/v1/domains/#{@domain.name}", headers: @auth_headers, params: payload.to_json
|
||||
@domain.reload
|
||||
json = JSON.parse(response.body, symbolize_names: true)
|
||||
assert_response :ok
|
||||
assert_equal 1000, json[:code]
|
||||
assert_equal 'Command completed successfully', json[:message]
|
||||
|
||||
assert new_auth_code, @domain.auth_info
|
||||
end
|
||||
|
||||
def test_domain_pending_update_on_registrant_change
|
||||
Setting.request_confirmation_on_registrant_change_enabled = true
|
||||
|
||||
@auth_headers['Content-Type'] = 'application/json'
|
||||
new_registrant = contacts(:william)
|
||||
refute @domain.registrant == new_registrant
|
||||
|
||||
payload = {
|
||||
domain: {
|
||||
registrant: {
|
||||
code: new_registrant.code
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
put "/repp/v1/domains/#{@domain.name}", headers: @auth_headers, params: payload.to_json
|
||||
@domain.reload
|
||||
json = JSON.parse(response.body, symbolize_names: true)
|
||||
assert_response :ok
|
||||
assert_equal 1000, json[:code]
|
||||
assert_equal 'Command completed successfully', json[:message]
|
||||
|
||||
refute @domain.registrant.code == new_registrant.code
|
||||
assert @domain.statuses.include? DomainStatus::PENDING_UPDATE
|
||||
end
|
||||
|
||||
def test_replaces_registrant_when_verified
|
||||
Setting.request_confirmation_on_registrant_change_enabled = true
|
||||
|
||||
@auth_headers['Content-Type'] = 'application/json'
|
||||
new_registrant = contacts(:william)
|
||||
refute @domain.registrant == new_registrant
|
||||
|
||||
payload = {
|
||||
domain: {
|
||||
registrant: {
|
||||
code: new_registrant.code,
|
||||
verified: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
put "/repp/v1/domains/#{@domain.name}", headers: @auth_headers, params: payload.to_json
|
||||
@domain.reload
|
||||
json = JSON.parse(response.body, symbolize_names: true)
|
||||
assert_response :ok
|
||||
assert_equal 1000, json[:code]
|
||||
assert_equal 'Command completed successfully', json[:message]
|
||||
|
||||
assert @domain.registrant.code == new_registrant.code
|
||||
refute @domain.statuses.include? DomainStatus::PENDING_UPDATE
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue