Bump epp-xml, fix some epp bugs

This commit is contained in:
Martin Lensment 2014-10-31 15:10:09 +02:00
parent 1498aa339f
commit 4c7895a7fb
7 changed files with 14 additions and 195 deletions

View file

@ -43,158 +43,6 @@ describe 'EPP Helper', epp: true do
expect(generated).to eq(expected)
end
it 'generates valid update xml' do
# Detailed update
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>example.ee</domain:name>
<domain:add>
<domain:ns>
<domain:hostObj>ns2.example.com</domain:hostObj>
</domain:ns>
<domain:contact type="tech">mak21</domain:contact>
<domain:status s="clientUpdateProhibited"/>
<domain:status s="clientHold"
lang="en">Payment overdue.</domain:status>
</domain:add>
<domain:rem>
<domain:ns>
<domain:hostObj>ns1.example.com</domain:hostObj>
</domain:ns>
<domain:contact type="tech">sh8013</domain:contact>
<domain:status s="clientUpdateProhibited"></domain:status>
</domain:rem>
<domain:chg>
<domain:registrant>mak21</domain:registrant>
</domain:chg>
</domain:update>
</update>
<clTRID>ABC-12345</clTRID>
</command>
</epp>
').to_s.squish
xml = domain_update_xml(
name: { value: 'example.ee' },
add: [
{ ns:
[
hostObj: { value: 'ns1.example.com' },
hostObj: { value: 'ns2.example.com' }
]
},
{ contact: { attrs: { type: 'tech' }, value: 'mak21' } },
{ status: { attrs: { s: 'clientUpdateProhibited' }, value: '' } },
{ status: { attrs: { s: 'clientHold', lang: 'en' }, value: 'Payment overdue.' } }
],
rem: [
ns: [
hostObj: { value: 'ns1.example.com' }
],
contact: { attrs: { type: 'tech' }, value: 'sh8013' },
status: { attrs: { s: 'clientUpdateProhibited' }, value: '' }
],
chg: [
registrant: { value: 'mak21' }
]
)
generated = Nokogiri::XML(xml).to_s.squish
expect(generated).to eq(expected)
# Update with NS IP-s
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:add>
<domain:contact type="admin">sh8013</domain:contact>
<domain:status s="testStatus"
lang="et">Payment overdue.</domain:status>
</domain:add>
<domain:rem>
<domain:ns>
<domain:hostAttr>
<domain:hostName>ns1.example.net</domain:hostName>
<domain:hostAddr ip="v4">192.0.2.2</domain:hostAddr>
<domain:hostAddr ip="v6">1080:0:0:0:8:800:200C:417A</domain:hostAddr>
</domain:hostAttr>
</domain:ns>
<domain:contact type="tech">sh8013</domain:contact>
<domain:status s="clientUpdateProhibited"></domain:status>
</domain:rem>
<domain:chg>
<domain:registrant>sh8013</domain:registrant>
</domain:chg>
</domain:update>
</update>
<clTRID>ABC-12345</clTRID>
</command>
</epp>
').to_s.squish
xml = domain_update_xml(
name: { value: 'one.ee' },
add: [
ns: nil,
contact: { value: 'sh8013', attrs: { type: 'admin' } },
status: { value: 'Payment overdue.', attrs: { s: 'testStatus', lang: 'et' } }
],
rem: [
ns: [
hostAttr: [
{ hostName: { value: 'ns1.example.net' } },
{ hostAddr: { value: '192.0.2.2', attrs: { ip: 'v4' } } },
{ hostAddr: { value: '1080:0:0:0:8:800:200C:417A', attrs: { ip: 'v6' } } }
]
],
contact: { attrs: { type: 'tech' }, value: 'sh8013' },
status: { attrs: { s: 'clientUpdateProhibited' }, value: '' }
],
chg: [
registrant: { value: 'sh8013' }
]
)
generated = Nokogiri::XML(xml).to_s.squish
expect(generated).to eq(expected)
## Update with chg
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>example.ee</domain:name>
<domain:chg>
<domain:registrant>mak21</domain:registrant>
</domain:chg>
</domain:update>
</update>
<clTRID>ABC-12345</clTRID>
</command>
</epp>
').to_s.squish
xml = domain_update_xml(
chg: [
registrant: { value: 'mak21' }
]
)
generated = Nokogiri::XML(xml).to_s.squish
expect(generated).to eq(expected)
end
it 'generates valid transfer xml' do
expected = Nokogiri::XML('<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">