Make domain available when reserved

This commit is contained in:
Artur Beljajev 2019-01-07 01:30:25 +02:00
parent 3772f47613
commit cad457fb72
3 changed files with 24 additions and 30 deletions

View file

@ -802,11 +802,6 @@ class Epp::Domain < Domain
next next
end end
if ReservedDomain.pw_for(domain_name_as_string).present?
result << { name: domain_name_as_string, avail: 0, reason: I18n.t('errors.messages.epp_domain_reserved') }
next
end
domain_name = DNS::DomainName.new(domain_name_as_string) domain_name = DNS::DomainName.new(domain_name_as_string)
if domain_name.unavailable? if domain_name.unavailable?

View file

@ -196,7 +196,6 @@ en:
errors: errors:
messages: messages:
blank: 'is missing' blank: 'is missing'
epp_domain_reserved: 'Domain name is reserved'
epp_domain_blocked: Blocked epp_domain_blocked: Blocked
epp_obj_does_not_exist: 'Object does not exist' epp_obj_does_not_exist: 'Object does not exist'
epp_authorization_error: 'Authorization error' epp_authorization_error: 'Authorization error'

View file

@ -23,7 +23,7 @@ class EppDomainCheckBaseTest < ApplicationIntegrationTest
assert_equal 'some.test', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text assert_equal 'some.test', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text
end end
def test_domain_is_available_when_not_registered_blocked_nor_reserved def test_domain_is_available_when_not_registered_or_blocked
request_xml = <<-XML request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd"> <epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
@ -44,6 +44,29 @@ class EppDomainCheckBaseTest < ApplicationIntegrationTest
assert_nil response_xml.at_xpath('//domain:reason', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd') assert_nil response_xml.at_xpath('//domain:reason', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')
end end
def test_domain_is_available_when_reserved
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>
<check>
<domain:check xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
<domain:name>reserved.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 '1', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['avail']
assert_nil response_xml.at_xpath('//domain:reason', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')
end
def test_domain_is_unavailable_when_format_is_invalid def test_domain_is_unavailable_when_format_is_invalid
request_xml = <<-XML request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
@ -111,29 +134,6 @@ class EppDomainCheckBaseTest < ApplicationIntegrationTest
assert_equal 'Blocked', response_xml.at_xpath('//domain:reason', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text assert_equal 'Blocked', response_xml.at_xpath('//domain:reason', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text
end end
def test_domain_is_unavailable_when_reserved
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>
<check>
<domain:check xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
<domain:name>reserved.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 'Domain name is reserved', response_xml.at_xpath('//domain:reason', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text
end
def test_multiple_domains def test_multiple_domains
request_xml = <<-XML request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>