Merge pull request #1319 from internetee/improve-epp-error-handling

Improve EPP error handling
This commit is contained in:
Timo Võhmar 2019-09-20 17:51:45 +03:00 committed by GitHub
commit 0f1edec88b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 279 additions and 286 deletions

View file

@ -0,0 +1,21 @@
require 'test_helper'
class EppDomainBaseTest < EppTestCase
def test_non_existent_domain
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>non-existent.test</domain:name>
</domain:info>
</info>
</command>
</epp>
XML
post '/epp/command/info', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
assert_epp_response :object_does_not_exist
end
end

View file

@ -207,30 +207,4 @@ class EppDomainDeleteBaseTest < EppTestCase
assert_epp_response :object_status_prohibits_operation
end
def test_domain_not_found
assert_nil Domain.find_by(name: 'non-existing.test')
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>
<delete>
<domain:delete xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
<domain:name>non-existing.test</domain:name>
</domain:delete>
</delete>
<extension>
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
<eis:legalDocument type="pdf">dGVzdCBmYWlsCg==</eis:legalDocument>
</eis:extdata>
</extension>
</command>
</epp>
XML
post '/epp/command/delete', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
assert_epp_response :object_does_not_exist
end
end

View file

@ -105,25 +105,4 @@ class EppDomainInfoBaseTest < EppTestCase
assert_nil response_xml.at_xpath('//domain:authInfo/domain:pw',
'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')
end
def test_returns_not_found_error_when_domain_is_not_registered
assert DNS::DomainName.new('not-registered.test').not_registered?
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>not-registered.test</domain:name>
</domain:info>
</info>
</command>
</epp>
XML
post '/epp/command/info', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
assert_epp_response :object_does_not_exist
end
end

View file

@ -1,25 +0,0 @@
require 'test_helper'
class EppDomainTransferBaseTest < EppTestCase
def test_non_existent_domain
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>
<transfer op="request">
<domain:transfer xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
<domain:name>non-existent.test</domain:name>
<domain:authInfo>
<domain:pw>any</domain:pw>
</domain:authInfo>
</domain:transfer>
</transfer>
</command>
</epp>
XML
post '/epp/command/transfer', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
assert_epp_response :object_does_not_exist
end
end

View file

@ -30,8 +30,7 @@ class EppDomainTransferQueryTest < EppTestCase
post '/epp/command/transfer', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
# https://github.com/internetee/registry/issues/686
assert_epp_response :authorization_error
assert_epp_response :invalid_authorization_information
end
def test_no_domain_transfer

View file

@ -115,10 +115,9 @@ class EppDomainTransferRequestTest < EppTestCase
post '/epp/command/transfer', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
@domain.reload
refute_equal @new_registrar, @domain.registrar
# https://github.com/internetee/registry/issues/686
assert_epp_response :authorization_error
assert_epp_response :invalid_authorization_information
refute_equal @new_registrar, @domain.registrar
end
private