Update.xml test improvement

This commit is contained in:
Martin Lensment 2014-08-25 16:03:45 +03:00
parent 45f72d45ec
commit 4c15f8bcb9
2 changed files with 27 additions and 2 deletions

View file

@ -249,6 +249,31 @@ describe 'EPP Helper', epp: true do
generated = Nokogiri::XML(domain_update_xml).to_s.squish
expect(generated).to eq(expected)
expected = Nokogiri::XML('<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command>
<update>
<domain:update
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>one.ee</domain:name>
<domain:chg>
<domain:registrant>sh8013</domain:registrant>
<domain:authInfo>
<domain:pw>b3rafsla</domain:pw>
</domain:authInfo>
</domain:chg>
</domain:update>
</update>
<clTRID>ABC-12345</clTRID>
</command>
</epp>
').to_s.squish
xml = domain_update_xml(name: 'one.ee', registrant: 'sh8013', pw: 'b3rafsla')
generated = Nokogiri::XML(xml).to_s.squish
expect(generated).to eq(expected)
end
end
end

View file

@ -161,7 +161,7 @@ module Epp
end
def domain_update_xml(xml_params = {})
xml_params[:name_value] = xml_params[:name_value] || 'example.ee'
xml_params[:name] = xml_params[:name] || 'example.ee'
xml_params[:registrant] = xml_params[:registrant] || 'mak21'
xml_params[:pw] = xml_params[:pw] || '2BARfoo'
@ -173,7 +173,7 @@ module Epp
xml.update do
xml.tag!('domain:update', 'xmlns:domain' => 'urn:ietf:params:xml:ns:domain-1.0') do
if xml_params[:name] != false
xml.tag!('domain:name', xml_params[:name_value])
xml.tag!('domain:name', xml_params[:name])
end
xml.tag!('domain:chg') do