Make domain unavailable when zone with the same origin exists

This commit is contained in:
Artur Beljajev 2019-01-07 03:20:55 +02:00
parent ee864c807f
commit d40dc28484
5 changed files with 41 additions and 3 deletions

View file

@ -134,6 +134,29 @@ class EppDomainCheckBaseTest < ApplicationIntegrationTest
assert_equal 'Blocked', response_xml.at_xpath('//domain:reason', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text
end
def test_domain_is_unavailable_when_zone_with_the_same_origin_exists
assert_equal 'test', dns_zones(:one).origin
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>
<check>
<domain:check xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
<domain:name>test</domain:name>
</domain:check>
</check>
</command>
</epp>
XML
post '/epp/command/check', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
response_xml = Nokogiri::XML(response.body)
assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['avail']
assert_equal 'Zone with the same origin exists', response_xml.at_xpath('//domain:reason', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text
end
def test_multiple_domains
request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>