mirror of
https://github.com/internetee/registry.git
synced 2025-06-11 07:04:47 +02:00
REPP: Extend domain transfer test
This commit is contained in:
parent
f2983da14c
commit
8790d1415a
2 changed files with 75 additions and 43 deletions
|
@ -32,6 +32,31 @@ class ReppV1DomainsTransferTest < ActionDispatch::IntegrationTest
|
|||
assert @domain.registrar = @user.registrar
|
||||
end
|
||||
|
||||
def test_does_not_transfer_domain_if_not_transferable
|
||||
@domain.schedule_force_delete(type: :fast_track)
|
||||
|
||||
payload = {
|
||||
"data": {
|
||||
"domain_transfers": [
|
||||
{ "domain_name": @domain.name, "transfer_code": @domain.transfer_code }
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
post "/repp/v1/domains/transfer", headers: @auth_headers, params: payload
|
||||
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 'Object status prohibits operation', json[:data][:failed][0][:errors][0][:msg]
|
||||
|
||||
@domain.reload
|
||||
|
||||
assert_not @domain.registrar == @user.registrar
|
||||
end
|
||||
|
||||
def test_does_not_transfer_domain_with_invalid_auth_code
|
||||
payload = {
|
||||
"data": {
|
||||
|
@ -49,4 +74,54 @@ class ReppV1DomainsTransferTest < ActionDispatch::IntegrationTest
|
|||
|
||||
assert_equal "Invalid authorization information", json[:data][:failed][0][:errors][0][:msg]
|
||||
end
|
||||
|
||||
def test_does_not_transfer_domain_to_same_registrar
|
||||
@domain.update!(registrar: @user.registrar)
|
||||
|
||||
payload = {
|
||||
"data": {
|
||||
"domain_transfers": [
|
||||
{ "domain_name": @domain.name, "transfer_code": @domain.transfer_code }
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
post "/repp/v1/domains/transfer", headers: @auth_headers, params: payload
|
||||
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 already belongs to the querying registrar', json[:data][:failed][0][:errors][0][:msg]
|
||||
|
||||
@domain.reload
|
||||
|
||||
assert @domain.registrar == @user.registrar
|
||||
end
|
||||
|
||||
def test_does_not_transfer_domain_if_discarded
|
||||
@domain.update!(statuses: [DomainStatus::DELETE_CANDIDATE])
|
||||
|
||||
payload = {
|
||||
"data": {
|
||||
"domain_transfers": [
|
||||
{ "domain_name": @domain.name, "transfer_code": @domain.transfer_code }
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
post "/repp/v1/domains/transfer", headers: @auth_headers, params: payload
|
||||
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 'Object is not eligible for transfer', json[:data][:failed][0][:errors][0][:msg]
|
||||
|
||||
@domain.reload
|
||||
|
||||
assert_not @domain.registrar == @user.registrar
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue