mirror of
https://github.com/internetee/registry.git
synced 2025-07-22 10:45:58 +02:00
Refactor
This commit is contained in:
parent
c9a01f5d11
commit
2574bb9329
2 changed files with 0 additions and 229 deletions
|
@ -2,149 +2,6 @@ require 'rails_helper'
|
|||
|
||||
describe 'EPP Helper', epp: true do
|
||||
context 'in context of Domain' do
|
||||
it 'generates valid login xml' do
|
||||
expected = Nokogiri::XML('<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '\
|
||||
'xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
|
||||
<command>
|
||||
<login>
|
||||
<clID>gitlab</clID>
|
||||
<pw>ghyt9e4fu</pw>
|
||||
<options>
|
||||
<version>1.0</version>
|
||||
<lang>en</lang>
|
||||
</options>
|
||||
<svcs>
|
||||
<objURI>urn:ietf:params:xml:ns:contact-1.0</objURI>
|
||||
</svcs>
|
||||
</login>
|
||||
<clTRID>ABC-12345</clTRID>
|
||||
</command>
|
||||
</epp>
|
||||
').to_s.squish
|
||||
|
||||
generated = Nokogiri::XML(login_xml).to_s.squish
|
||||
expect(generated).to eq(expected)
|
||||
end
|
||||
|
||||
it 'generates valid create xml' do
|
||||
expected = Nokogiri::XML('<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||
<command>
|
||||
<create>
|
||||
<domain:create
|
||||
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||
<domain:name>example.ee</domain:name>
|
||||
<domain:period unit="y">1</domain:period>
|
||||
<domain:ns>
|
||||
<domain:hostObj>ns1.example.net</domain:hostObj>
|
||||
<domain:hostObj>ns2.example.net</domain:hostObj>
|
||||
</domain:ns>
|
||||
<domain:registrant>jd1234</domain:registrant>
|
||||
<domain:contact type="admin">sh8013</domain:contact>
|
||||
<domain:contact type="tech">sh8013</domain:contact>
|
||||
<domain:contact type="tech">sh801333</domain:contact>
|
||||
</domain:create>
|
||||
</create>
|
||||
<extension>
|
||||
<secDNS:create xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1">
|
||||
<secDNS:keyData>
|
||||
<secDNS:flags>257</secDNS:flags>
|
||||
<secDNS:protocol>3</secDNS:protocol>
|
||||
<secDNS:alg>5</secDNS:alg>
|
||||
<secDNS:pubKey>AwEAAddt2AkLfYGKgiEZB5SmIF8EvrjxNMH6HtxWEA4RJ9Ao6LCWheg8</secDNS:pubKey>
|
||||
</secDNS:keyData>
|
||||
</secDNS:create>
|
||||
</extension>
|
||||
<clTRID>ABC-12345</clTRID>
|
||||
</command>
|
||||
</epp>
|
||||
').to_s.squish
|
||||
|
||||
generated = Nokogiri::XML(domain_create_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>
|
||||
<create>
|
||||
<domain:create
|
||||
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||
<domain:name>one.ee</domain:name>
|
||||
<domain:period unit="d">345</domain:period>
|
||||
<domain:ns>
|
||||
<domain:hostObj>ns1.test.net</domain:hostObj>
|
||||
<domain:hostObj>ns2.test.net</domain:hostObj>
|
||||
</domain:ns>
|
||||
<domain:registrant>32fsdaf</domain:registrant>
|
||||
<domain:contact type="admin">2323rafaf</domain:contact>
|
||||
<domain:contact type="tech">3dgxx</domain:contact>
|
||||
<domain:contact type="tech">345xxv</domain:contact>
|
||||
</domain:create>
|
||||
</create>
|
||||
<extension>
|
||||
<secDNS:create xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1">
|
||||
<secDNS:keyData>
|
||||
<secDNS:flags>257</secDNS:flags>
|
||||
<secDNS:protocol>3</secDNS:protocol>
|
||||
<secDNS:alg>5</secDNS:alg>
|
||||
<secDNS:pubKey>AwEAAddt2AkLfYGKgiEZB5SmIF8EvrjxNMH6HtxWEA4RJ9Ao6LCWheg8</secDNS:pubKey>
|
||||
</secDNS:keyData>
|
||||
</secDNS:create>
|
||||
</extension>
|
||||
<clTRID>ABC-12345</clTRID>
|
||||
</command>
|
||||
</epp>
|
||||
').to_s.squish
|
||||
|
||||
xml = domain_create_xml({
|
||||
name: { value: 'one.ee' },
|
||||
period: { value: '345', attrs: { unit: 'd' } },
|
||||
ns: [
|
||||
{ hostObj: { value: 'ns1.test.net' } },
|
||||
{ hostObj: { value: 'ns2.test.net' } }
|
||||
],
|
||||
registrant: { value: '32fsdaf' },
|
||||
_other: [
|
||||
{ contact: { value: '2323rafaf', attrs: { type: 'admin' } } },
|
||||
{ contact: { value: '3dgxx', attrs: { type: 'tech' } } },
|
||||
{ contact: { value: '345xxv', attrs: { type: 'tech' } } }
|
||||
]
|
||||
})
|
||||
|
||||
generated = Nokogiri::XML(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>
|
||||
<create>
|
||||
<domain:create
|
||||
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||
<domain:name>one.ee</domain:name>
|
||||
</domain:create>
|
||||
</create>
|
||||
<clTRID>ABC-12345</clTRID>
|
||||
</command>
|
||||
</epp>
|
||||
').to_s.squish
|
||||
|
||||
xml = domain_create_xml({
|
||||
name: { value: 'one.ee' },
|
||||
period: nil,
|
||||
ns: nil,
|
||||
registrant: nil,
|
||||
_other: nil
|
||||
}, false)
|
||||
|
||||
generated = Nokogiri::XML(xml).to_s.squish
|
||||
expect(generated).to eq(expected)
|
||||
end
|
||||
|
||||
it 'generates valid info xml' do
|
||||
expected = Nokogiri::XML('<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue