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:
Timo Võhmar 2021-02-23 17:01:56 +02:00 committed by GitHub
commit 02ec43a1dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 71 additions and 2 deletions

View file

@ -34,6 +34,33 @@ class ReppV1RegistrarNameserversTest < ActionDispatch::IntegrationTest
assert json[:data][:affected_domains].include? 'shop.test'
end
def test_fails_to_update_if_prohibited
domain = domains(:shop)
domain.update(statuses: [DomainStatus::CLIENT_UPDATE_PROHIBITED])
nameserver = nameservers(:shop_ns1)
payload = {
"data": {
"id": nameserver.hostname,
"type": "nameserver",
"attributes": {
"hostname": "#{nameserver.hostname}.test",
"ipv4": ["1.1.1.1"]
}
}
}
put '/repp/v1/registrar/nameservers', 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({ hostname: "#{nameserver.hostname}.test", ipv4: ["1.1.1.1"] }, json[:data][:attributes])
assert_equal({ hostname: "#{nameserver.hostname}.test", ipv4: ["1.1.1.1"] }, json[:data][:attributes])
assert json[:data][:affected_domains].include? 'airport.test'
assert json[:data][:skipped_domains].include? 'shop.test'
end
def test_nameserver_with_hostname_must_exist
payload = {
"data": {