Add a new test for domain info query, epp_errors improvement

This commit is contained in:
Martin Lensment 2014-08-14 16:50:54 +03:00
parent 5b91acb343
commit 28a6b59a55
7 changed files with 34 additions and 3 deletions

View file

@ -234,6 +234,12 @@ describe 'EPP Domain', epp: true do
expect(inf_data.css('upDate').text).to eq(d.updated_at.to_time.utc.to_s)
end
it 'returns error when domain can not be found' do
response = epp_request(domain_info_xml(name_value: 'test.ee'), :xml)
expect(response[:results][0][:result_code]).to eq('2303')
expect(response[:results][0][:msg]).to eq('Domain not found')
end
end
it 'checks a domain' do

View file

@ -114,6 +114,9 @@ describe 'EPP Helper', epp: true do
<domain:info
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name hosts="all">example.ee</domain:name>
<domain:authInfo>
<domain:pw>2fooBAR</domain:pw>
</domain:authInfo>
</domain:info>
</info>
<clTRID>ABC-12345</clTRID>
@ -132,6 +135,9 @@ describe 'EPP Helper', epp: true do
<domain:info
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name hosts="sub">one.ee</domain:name>
<domain:authInfo>
<domain:pw>b3rafsla</domain:pw>
</domain:authInfo>
</domain:info>
</info>
<clTRID>ABC-12345</clTRID>
@ -140,7 +146,7 @@ describe 'EPP Helper', epp: true do
').to_s.squish
generated = Nokogiri::XML(domain_info_xml(name_value: 'one.ee', name_hosts: 'sub')).to_s.squish
generated = Nokogiri::XML(domain_info_xml(name_value: 'one.ee', name_hosts: 'sub', pw: 'b3rafsla')).to_s.squish
expect(generated).to eq(expected)
end
end

View file

@ -128,6 +128,7 @@ module Epp
def domain_info_xml(xml_params={})
xml_params[:name_value] = xml_params[:name_value] || 'example.ee'
xml_params[:name_hosts] = xml_params[:name_hosts] || 'all'
xml_params[:pw] = xml_params[:pw] || '2fooBAR'
xml = Builder::XmlMarkup.new
@ -137,6 +138,9 @@ module Epp
xml.info do
xml.tag!('domain:info', 'xmlns:domain' => 'urn:ietf:params:xml:ns:domain-1.0') do
xml.tag!('domain:name', xml_params[:name_value], 'hosts' => xml_params[:name_hosts]) if xml_params[:name] != false
xml.tag!('domain:authInfo') do
xml.tag!('domain:pw', xml_params[:pw])
end
end
end
xml.clTRID 'ABC-12345'