Merge pull request #1765 from internetee/fix-epp-domain-status-missing-error

EPP: Show error when trying to remove unassigned domain status
This commit is contained in:
Timo Võhmar 2020-12-01 15:46:51 +02:00 committed by GitHub
commit 23d77ebccf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 2 deletions

View file

@ -417,7 +417,7 @@ class Epp::Domain < Domain
if statuses.include?(x) if statuses.include?(x)
to_destroy << x to_destroy << x
else else
add_epp_error('2303', 'status', x, [:domain_statuses, :not_found]) add_epp_error('2303', 'status', x, %i[statuses not_found])
end end
end end
@ -432,7 +432,7 @@ class Epp::Domain < Domain
frame.css('status').each do |x| frame.css('status').each do |x|
unless DomainStatus::CLIENT_STATUSES.include?(x['s']) unless DomainStatus::CLIENT_STATUSES.include?(x['s'])
add_epp_error('2303', 'status', x['s'], [:domain_statuses, :not_found]) add_epp_error('2303', 'status', x['s'], %i[statuses not_found])
next next
end end

View file

@ -503,6 +503,30 @@ class EppDomainUpdateBaseTest < EppTestCase
assert_not_includes(@domain.statuses, DomainStatus::CLIENT_HOLD) assert_not_includes(@domain.statuses, DomainStatus::CLIENT_HOLD)
end end
def test_update_domain_returns_error_when_removing_unassigned_status
assert_not_includes(@domain.statuses, DomainStatus::CLIENT_HOLD)
request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
<command>
<update>
<domain:update xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
<domain:name>#{@domain.name}</domain:name>
<domain:rem>
<domain:status s="clientHold"/>
</domain:rem>
</domain:update>
</update>
</command>
</epp>
XML
post epp_update_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
@domain.reload
assert_epp_response :object_does_not_exist
end
private private
def assert_verification_and_notification_emails def assert_verification_and_notification_emails