mirror of
https://github.com/internetee/registry.git
synced 2025-06-09 22:24:47 +02:00
Merge pull request #1846 from internetee/1818-block-bulk-changes-on-update-prohibited
Add check if UpdateProhibited to nameserver bulk update
This commit is contained in:
commit
02ec43a1dc
5 changed files with 71 additions and 2 deletions
|
@ -63,6 +63,23 @@ class APIDomainTransfersTest < ApplicationIntegrationTest
|
|||
assert_equal 1, @new_registrar.contacts.where(name: 'William').size
|
||||
end
|
||||
|
||||
def test_bulk_transfer_if_domain_has_update_prohibited_status
|
||||
domains(:shop).update!(statuses: [DomainStatus::SERVER_UPDATE_PROHIBITED])
|
||||
|
||||
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",
|
||||
errors: [{:code=>"2304", :msg=>"Object status prohibits operation"}] }],
|
||||
}}),
|
||||
JSON.parse(response.body, symbolize_names: true)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def request_params
|
||||
|
|
|
@ -104,6 +104,25 @@ class APINameserversPutTest < ApplicationIntegrationTest
|
|||
JSON.parse(response.body, symbolize_names: true)
|
||||
end
|
||||
|
||||
def test_bulk_namesaervers_if_domain_update_prohibited
|
||||
domains(:shop).update!(statuses: [DomainStatus::SERVER_UPDATE_PROHIBITED])
|
||||
|
||||
params = { data: { type: 'nameserver', id: domains(:shop).nameservers.hostnames[0],
|
||||
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: { 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
|
||||
|
||||
def test_unauthenticated
|
||||
put '/repp/v1/registrar/nameservers'
|
||||
assert_response 401
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue