From 44add87fe24fa96b527f64a9c119437bf4bd6d77 Mon Sep 17 00:00:00 2001 From: Alex Sherman Date: Mon, 22 Feb 2021 13:54:41 +0500 Subject: [PATCH] Add tests on domain transfer --- app/models/concerns/domain/transferable.rb | 4 +++- test/integration/api/domain_transfers_test.rb | 7 +++++-- test/integration/api/nameservers/put_test.rb | 11 +++++++---- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/app/models/concerns/domain/transferable.rb b/app/models/concerns/domain/transferable.rb index 5400e9409..649600217 100644 --- a/app/models/concerns/domain/transferable.rb +++ b/app/models/concerns/domain/transferable.rb @@ -31,7 +31,9 @@ module Concerns::Domain::Transferable DomainStatus::PENDING_TRANSFER, DomainStatus::FORCE_DELETE, DomainStatus::SERVER_TRANSFER_PROHIBITED, - DomainStatus::CLIENT_TRANSFER_PROHIBITED + DomainStatus::CLIENT_TRANSFER_PROHIBITED, + DomainStatus::SERVER_UPDATE_PROHIBITED, + DomainStatus::CLIENT_UPDATE_PROHIBITED, ]).empty? end diff --git a/test/integration/api/domain_transfers_test.rb b/test/integration/api/domain_transfers_test.rb index 2cf12130b..3ed5b0fc6 100644 --- a/test/integration/api/domain_transfers_test.rb +++ b/test/integration/api/domain_transfers_test.rb @@ -68,12 +68,15 @@ class APIDomainTransfersTest < ApplicationIntegrationTest post '/repp/v1/domains/transfer', params: request_params, as: :json, headers: { 'HTTP_AUTHORIZATION' => http_auth_key } - + assert_response :ok assert_equal ({ code: 1000, message: 'Command completed successfully', data: { success: [], - failed: [{ type: "domain_transfer", domain_name: "shop.test" }] }}), + failed: [{ type: "domain_transfer", + domain_name: "shop.test", + errors: [{:code=>"2304", :msg=>"Object status prohibits operation"}] }], + }}), JSON.parse(response.body, symbolize_names: true) end diff --git a/test/integration/api/nameservers/put_test.rb b/test/integration/api/nameservers/put_test.rb index f1a478da6..a55014709 100644 --- a/test/integration/api/nameservers/put_test.rb +++ b/test/integration/api/nameservers/put_test.rb @@ -108,15 +108,18 @@ class APINameserversPutTest < ApplicationIntegrationTest domains(:shop).update!(statuses: [DomainStatus::SERVER_UPDATE_PROHIBITED]) params = { data: { type: 'nameserver', id: domains(:shop).nameservers.hostnames[0], - attributes: { hostname: 'ns55.bestnames.test' } } } + attributes: { hostname: 'ns55.bestnames.test' } } } put '/repp/v1/registrar/nameservers', params: params, as: :json, headers: { 'HTTP_AUTHORIZATION' => http_auth_key } - + assert_response :ok assert_equal ({ code: 1000, message: 'Command completed successfully', - data: { affected_domains: ["airport.test"], - skipped_domains: ["shop.test"] }}), + data: { type: "nameserver", + id: "ns55.bestnames.test", + attributes: {hostname: "ns55.bestnames.test"}, + affected_domains: ["airport.test"], + skipped_domains: ["shop.test"]}}), JSON.parse(response.body, symbolize_names: true) end