Refactor epp requests closer to international standard

This commit is contained in:
Martin Lensment 2014-07-03 17:47:53 +03:00
parent 4684b311a2
commit 9def6a7c27
11 changed files with 81 additions and 70 deletions

View file

@ -1,7 +1,7 @@
require 'rails_helper'
describe 'EPP Domain', epp: true do
let(:server) { server = Epp::Server.new({server: 'localhost', tag: 'test', password: 'test', port: 701}) }
let(:server) { server = Epp::Server.new({server: 'localhost', tag: 'gitlab', password: 'ghyt9e4fu', port: 701}) }
context 'with valid user' do
before(:each) { Fabricate(:epp_user) }
@ -11,28 +11,27 @@ describe 'EPP Domain', epp: true do
response = epp_request('domains/create.xml')
expect(response[:result_code]).to eq('1000')
expect(response[:msg]).to eq('Command completed successfully')
expect(response[:clTRID]).to eq('dpbx005#10-01-29at19:21:47')
expect(response[:clTRID]).to eq('ABC-12345')
expect(Domain.first.registrar.name).to eq('Zone Media OÜ')
end
# incomplete
it 'checks a domain' do
response = epp_request('domains/check.xml')
expect(response[:result_code]).to eq('1000')
expect(response[:msg]).to eq('Command completed successfully')
domain = response[:parsed].css('resData chkData cd name').first
expect(domain.text).to eq('test.ee')
expect(domain.text).to eq('one.ee')
expect(domain[:avail]).to eq('1')
Fabricate(:domain, name: 'test.ee')
Fabricate(:domain, name: 'one.ee')
response = epp_request('domains/check.xml')
domain = response[:parsed].css('resData chkData cd').first
name = domain.css('name').first
reason = domain.css('reason').first
expect(name.text).to eq('test.ee')
expect(name.text).to eq('one.ee')
expect(name[:avail]).to eq('0')
expect(reason.text).to eq('in use') #confirm this with current API
end
@ -43,11 +42,11 @@ describe 'EPP Domain', epp: true do
expect(response[:msg]).to eq('Command completed successfully')
domain = response[:parsed].css('resData chkData cd name').first
expect(domain.text).to eq('test.ee')
expect(domain.text).to eq('one.ee')
expect(domain[:avail]).to eq('1')
domain = response[:parsed].css('resData chkData cd name').last
expect(domain.text).to eq('bla.ee')
expect(domain.text).to eq('three.ee')
expect(domain[:avail]).to eq('1')
end
@ -57,14 +56,14 @@ describe 'EPP Domain', epp: true do
expect(response[:msg]).to eq('Command completed successfully')
domain = response[:parsed].css('resData chkData cd name').first
expect(domain.text).to eq('test.ee')
expect(domain.text).to eq('one.ee')
expect(domain[:avail]).to eq('1')
domain = response[:parsed].css('resData chkData cd').last
name = domain.css('name').first
reason = domain.css('reason').first
expect(name.text).to eq('asdasd')
expect(name.text).to eq('notcorrectdomain')
expect(name[:avail]).to eq('0')
expect(reason.text).to eq('invalid format')
end

View file

@ -1,6 +1,12 @@
<?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><check><domain:check xmlns:domain="http://www.nic.cz/xml/epp/domain-1.4" xsi:schemaLocation="http://www.nic.cz/xml/epp/domain-1.4 domain-1.4.xsd"><domain:name>test.ee</domain:name>
</domain:check>
</check>
<clTRID>imkt004#14-06-27at16:13:33</clTRID>
</command>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command>
<check>
<domain:check
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>one.ee</domain:name>
</domain:check>
</check>
<clTRID>ABC-12345</clTRID>
</command>
</epp>

View file

@ -1,7 +1,14 @@
<?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><check><domain:check xmlns:domain="http://www.nic.cz/xml/epp/domain-1.4" xsi:schemaLocation="http://www.nic.cz/xml/epp/domain-1.4 domain-1.4.xsd"><domain:name>test.ee</domain:name>
<domain:name>bla.ee</domain:name>
</domain:check>
</check>
<clTRID>naug002#14-06-30at10:45:27</clTRID>
</command>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command>
<check>
<domain:check
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>one.ee</domain:name>
<domain:name>two.ee</domain:name>
<domain:name>three.ee</domain:name>
</domain:check>
</check>
<clTRID>ABC-12345</clTRID>
</command>
</epp>

View file

@ -1,8 +1,13 @@
<?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><check><domain:check xmlns:domain="http://www.nic.cz/xml/epp/domain-1.4" xsi:schemaLocation="http://www.nic.cz/xml/epp/domain-1.4 domain-1.4.xsd"><domain:name>test.ee</domain:name>
<domain:name>bla.ee</domain:name>
<domain:name>asdasd</domain:name>
</domain:check>
</check>
<clTRID>ixsz002#14-06-30at11:43:32</clTRID>
</command>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command>
<check>
<domain:check
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>one.ee</domain:name>
<domain:name>notcorrectdomain</domain:name>
</domain:check>
</check>
<clTRID>ABC-12345</clTRID>
</command>
</epp>

View file

@ -1,21 +1,23 @@
<?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">
<?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="http://www.nic.cz/xml/epp/domain-1.4" xsi:schemaLocation="http://www.nic.cz/xml/epp/domain-1.4 domain-1.4.xsd">
<domain:name>testing.ee</domain:name>
<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:nsset>name_server_set1</domain:nsset>
<domain:registrant>domain_registrator1</domain:registrant>
<domain:admin>administrative_contact1</domain:admin>
<domain:authInfo>password</domain:authInfo>
<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:authInfo>
<domain:pw>2fooBAR</domain:pw>
</domain:authInfo>
</domain:create>
</create>
<extension>
<eis:extdata xmlns:eis="urn:ee:eis:xml:epp:eis-1.0" xsi:schemaLocation="urn:ee:eis:xml:epp:eis-1.0 eis-1.0.xsd">
<eis:legalDocument type="ddoc">.... base64 encoded document ....</eis:legalDocument>
</eis:extdata>
</extension>
<clTRID>dpbx005#10-01-29at19:21:47</clTRID>
<clTRID>ABC-12345</clTRID>
</command>
</epp>

View file

@ -1,7 +1,7 @@
require 'rails_helper'
describe 'EPP Session', epp: true do
let(:server) { server = Epp::Server.new({server: 'localhost', tag: 'test', password: 'test', port: 701}) }
let(:server) { server = Epp::Server.new({server: 'localhost', tag: 'gitlab', password: 'ghyt9e4fu', port: 701}) }
context 'when not connected' do
it 'greets client upon connection' do