Update tests

#660
This commit is contained in:
Artur Beljajev 2018-01-29 02:22:28 +02:00
parent 029afdc39c
commit 56576d6590
4 changed files with 119 additions and 4 deletions

View file

@ -5,7 +5,7 @@ class EppDomainTransferTest < ActionDispatch::IntegrationTest
login_as users(:api_goodnames)
end
def test_transfers_domain
def test_successfully_transfers_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">
@ -24,7 +24,30 @@ class EppDomainTransferTest < ActionDispatch::IntegrationTest
session_id = epp_sessions(:api_goodnames).session_id
post '/epp/command/transfer', { frame: request_xml }, { 'HTTP_COOKIE' => "session=#{session_id}" }
assert_response 200
assert_equal registrars(:goodnames), domains(:shop).registrar
assert Nokogiri::XML(response.body).at_css('result[code="1000"]')
assert_equal 1, Nokogiri::XML(response.body).css('result').size
end
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
session_id = epp_sessions(:api_goodnames).session_id
post '/epp/command/transfer', { frame: request_xml }, { 'HTTP_COOKIE' => "session=#{session_id}" }
assert Nokogiri::XML(response.body).at_css('result[code="2303"]')
end
end