Merge branch 'master' of github.com:internetee/registry

This commit is contained in:
Andres Keskküla 2014-08-15 11:53:12 +03:00
commit 5fa1107e3e
11 changed files with 123 additions and 45 deletions

View file

@ -178,7 +178,7 @@ describe 'EPP Domain', epp: true do
before(:each) { Fabricate(:domain, name: 'example.ee') }
it 'renews a domain' do
response = epp_request('domains/renew.xml')
response = epp_request(domain_renew_xml, :xml)
exDate = response[:parsed].css('renData exDate').text
name = response[:parsed].css('renData name').text
expect(exDate).to eq ('2015-08-07 00:00:00 UTC')
@ -234,10 +234,16 @@ 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
response = epp_request('domains/check.xml')
response = epp_request(domain_check_xml, :xml)
expect(response[:result_code]).to eq('1000')
expect(response[:msg]).to eq('Command completed successfully')
@ -247,7 +253,7 @@ describe 'EPP Domain', epp: true do
Fabricate(:domain, name: 'example.ee')
response = epp_request('domains/check.xml')
response = epp_request(domain_check_xml, :xml)
domain = response[:parsed].css('resData chkData cd').first
name = domain.css('name').first
reason = domain.css('reason').first

View file

@ -106,7 +106,7 @@ describe 'EPP Helper', epp: true do
expect(generated).to eq(expected)
end
it 'creates valid info request' do
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">
<command>
@ -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,89 @@ 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
it 'generates valid check 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>
<check>
<domain:check
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>example.ee</domain:name>
</domain:check>
</check>
<clTRID>ABC-12345</clTRID>
</command>
</epp>
').to_s.squish
generated = Nokogiri::XML(domain_check_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>
<check>
<domain:check
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>example.ee</domain:name>
<domain:name>example2.ee</domain:name>
<domain:name>example3.ee</domain:name>
</domain:check>
</check>
<clTRID>ABC-12345</clTRID>
</command>
</epp>
').to_s.squish
generated = Nokogiri::XML(domain_check_xml(names: ['example.ee', 'example2.ee', 'example3.ee'])).to_s.squish
expect(generated).to eq(expected)
end
it 'generates valid renew 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>
<renew>
<domain:renew
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>example.ee</domain:name>
<domain:curExpDate>2014-08-07</domain:curExpDate>
<domain:period unit="y">1</domain:period>
</domain:renew>
</renew>
<clTRID>ABC-12345</clTRID>
</command>
</epp>
').to_s.squish
generated = Nokogiri::XML(domain_renew_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>
<renew>
<domain:renew
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>one.ee</domain:name>
<domain:curExpDate>2009-11-15</domain:curExpDate>
<domain:period unit="d">365</domain:period>
</domain:renew>
</renew>
<clTRID>ABC-12345</clTRID>
</command>
</epp>
').to_s.squish
generated = Nokogiri::XML(domain_renew_xml(name: 'one.ee', curExpDate: '2009-11-15', period_value: '365', period_unit: 'd')).to_s.squish
expect(generated).to eq(expected)
end
end

View file

@ -1,12 +0,0 @@
<?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>example.ee</domain:name>
</domain:check>
</check>
<clTRID>ABC-12345</clTRID>
</command>
</epp>

View file

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command>
<info>
<domain:info
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name hosts="all">example.ee</domain:name>
</domain:info>
</info>
<clTRID>ABC-12345</clTRID>
</command>
</epp>

View file

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command>
<renew>
<domain:renew
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>example.ee</domain:name>
<domain:curExpDate>2014-08-07</domain:curExpDate>
<domain:period unit="y">1</domain:period>
</domain:renew>
</renew>
<clTRID>ABC-12345</clTRID>
</command>
</epp>