Handle blocked and reserved domains in EPP domain:info

Closes #597
This commit is contained in:
Artur Beljajev 2019-02-01 13:20:58 +02:00
parent f1148bd4f4
commit 36a53bd11a
6 changed files with 117 additions and 19 deletions

View file

@ -106,4 +106,54 @@ class EppDomainInfoBaseTest < ApplicationIntegrationTest
assert_nil response_xml.at_xpath('//domain:authInfo/domain:pw',
'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')
end
def test_blocked_domain
assert_equal 'blocked.test', blocked_domains(:one).name
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>
<info>
<domain:info xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
<domain:name>blocked.test</domain:name>
</domain:info>
</info>
</command>
</epp>
XML
post '/epp/command/info', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
response_xml = Nokogiri::XML(response.body)
assert_equal '1000', response_xml.at_css('result')[:code]
assert_equal 1, response_xml.css('result').size
assert_equal 'blocked.test', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text
assert_equal 'Blocked', response_xml.at_xpath('//domain:status', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['s']
end
def test_reserved_domain
assert_equal 'reserved.test', reserved_domains(:one).name
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>
<info>
<domain:info xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
<domain:name>reserved.test</domain:name>
</domain:info>
</info>
</command>
</epp>
XML
post '/epp/command/info', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
response_xml = Nokogiri::XML(response.body)
assert_equal '1000', response_xml.at_css('result')[:code]
assert_equal 1, response_xml.css('result').size
assert_equal 'reserved.test', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text
assert_equal 'Reserved', response_xml.at_xpath('//domain:status', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['s']
end
end