This commit is contained in:
Artur Beljajev 2019-10-01 16:27:49 +03:00
parent 9e5fdbcf11
commit 7963bf9286

View file

@ -13,16 +13,9 @@ class EppBaseTest < EppTestCase
constraints: EppConstraint.new(:poll) constraints: EppConstraint.new(:poll)
end end
any_valid_epp_request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
<hello/>
</epp>
XML
begin begin
assert_difference 'ApiLog::EppLog.count' do assert_difference 'ApiLog::EppLog.count' do
post '/epp/command/internal_error', { frame: any_valid_epp_request_xml }, post '/epp/command/internal_error', { frame: valid_request_xml },
'HTTP_COOKIE' => 'session=api_bestnames' 'HTTP_COOKIE' => 'session=api_bestnames'
end end
assert_epp_response :command_failed assert_epp_response :command_failed
@ -33,14 +26,13 @@ class EppBaseTest < EppTestCase
end end
end end
def test_invalid_request def test_validates_request_xml
invalid_xml = <<-XML invalid_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">
</epp> </epp>
XML XML
post '/epp/command/internal_error', { frame: invalid_xml }, post valid_command_path, { frame: invalid_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
'HTTP_COOKIE' => 'session=api_bestnames'
assert_epp_response :syntax_error assert_epp_response :syntax_error
end end
@ -87,4 +79,19 @@ class EppBaseTest < EppTestCase
assert_epp_response :authorization_error assert_epp_response :authorization_error
end end
private
def valid_command_path
epp_command_poll_path
end
def valid_request_xml
<<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
<hello/>
</epp>
XML
end
end end