mirror of
https://github.com/internetee/registry.git
synced 2025-07-20 17:55:55 +02:00
Refactor update requests to use builder
This commit is contained in:
parent
177425d769
commit
3f4f7ac513
4 changed files with 47 additions and 66 deletions
|
@ -354,13 +354,27 @@ describe 'EPP Domain', epp: true do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'updates domain and adds objects' do
|
it 'updates domain and adds objects' do
|
||||||
response = epp_request('domains/update_add_objects.xml')
|
xml = domain_update_xml({
|
||||||
|
add: [
|
||||||
|
{
|
||||||
|
ns: [
|
||||||
|
{ hostObj: { value: 'ns1.example.com' } },
|
||||||
|
{ hostObj: { value: 'ns2.example.com' } }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{ contact: { value: 'mak21', attrs: { type: 'tech' } } },
|
||||||
|
{ status: { value: 'Payment overdue.', attrs: { s: 'clientHold', lang: 'en' } } },
|
||||||
|
{ status: { value: '', attrs: { s: 'clientUpdateProhibited' } } }
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
|
response = epp_request(xml, :xml)
|
||||||
expect(response[:results][0][:result_code]).to eq('2303')
|
expect(response[:results][0][:result_code]).to eq('2303')
|
||||||
expect(response[:results][0][:msg]).to eq('Contact was not found')
|
expect(response[:results][0][:msg]).to eq('Contact was not found')
|
||||||
|
|
||||||
Fabricate(:contact, code: 'mak21')
|
Fabricate(:contact, code: 'mak21')
|
||||||
|
|
||||||
response = epp_request('domains/update_add_objects.xml')
|
response = epp_request(xml, :xml)
|
||||||
expect(response[:results][0][:result_code]).to eq('1000')
|
expect(response[:results][0][:result_code]).to eq('1000')
|
||||||
|
|
||||||
d = Domain.first
|
d = Domain.first
|
||||||
|
@ -377,7 +391,7 @@ describe 'EPP Domain', epp: true do
|
||||||
|
|
||||||
expect(d.domain_statuses.last.value).to eq('clientUpdateProhibited')
|
expect(d.domain_statuses.last.value).to eq('clientUpdateProhibited')
|
||||||
|
|
||||||
response = epp_request('domains/update_add_objects.xml')
|
response = epp_request(xml, :xml)
|
||||||
expect(response[:results][0][:result_code]).to eq('2302')
|
expect(response[:results][0][:result_code]).to eq('2302')
|
||||||
expect(response[:results][0][:msg]).to eq('Nameserver already exists on this domain')
|
expect(response[:results][0][:msg]).to eq('Nameserver already exists on this domain')
|
||||||
expect(response[:results][0][:value]).to eq('ns1.example.com')
|
expect(response[:results][0][:value]).to eq('ns1.example.com')
|
||||||
|
@ -391,11 +405,38 @@ describe 'EPP Domain', epp: true do
|
||||||
|
|
||||||
it 'updates a domain and removes objects' do
|
it 'updates a domain and removes objects' do
|
||||||
Fabricate(:contact, code: 'mak21')
|
Fabricate(:contact, code: 'mak21')
|
||||||
epp_request('domains/update_add_objects.xml')
|
|
||||||
|
xml = domain_update_xml({
|
||||||
|
add: [
|
||||||
|
{
|
||||||
|
ns: [
|
||||||
|
{ hostObj: { value: 'ns1.example.com' } },
|
||||||
|
{ hostObj: { value: 'ns2.example.com' } }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{ contact: { value: 'mak21', attrs: { type: 'tech' } } },
|
||||||
|
{ status: { value: 'Payment overdue.', attrs: { s: 'clientHold', lang: 'en' } } },
|
||||||
|
{ status: { value: '', attrs: { s: 'clientUpdateProhibited' } } }
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
|
epp_request(xml, :xml)
|
||||||
|
|
||||||
|
xml = domain_update_xml({
|
||||||
|
rem: [
|
||||||
|
{
|
||||||
|
ns: [
|
||||||
|
{ hostObj: { value: 'ns1.example.com' } }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{ contact: { value: 'mak21', attrs: { type: 'tech' } } },
|
||||||
|
{ status: { value: '', attrs: { s: 'clientHold' } } }
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
d = Domain.last
|
d = Domain.last
|
||||||
|
|
||||||
epp_request('domains/update_remove_objects.xml')
|
epp_request(xml, :xml)
|
||||||
|
|
||||||
expect(d.domain_statuses.count).to eq(1)
|
expect(d.domain_statuses.count).to eq(1)
|
||||||
expect(d.domain_statuses.first.value).to eq('clientUpdateProhibited')
|
expect(d.domain_statuses.first.value).to eq('clientUpdateProhibited')
|
||||||
|
@ -406,7 +447,7 @@ describe 'EPP Domain', epp: true do
|
||||||
rem_cnt = d.tech_contacts.find_by(code: 'mak21')
|
rem_cnt = d.tech_contacts.find_by(code: 'mak21')
|
||||||
expect(rem_cnt).to be_falsey
|
expect(rem_cnt).to be_falsey
|
||||||
|
|
||||||
response = epp_request('domains/update_remove_objects.xml')
|
response = epp_request(xml, :xml)
|
||||||
expect(response[:results][0][:result_code]).to eq('2303')
|
expect(response[:results][0][:result_code]).to eq('2303')
|
||||||
expect(response[:results][0][:msg]).to eq('Contact was not found')
|
expect(response[:results][0][:msg]).to eq('Contact was not found')
|
||||||
expect(response[:results][0][:value]).to eq('mak21')
|
expect(response[:results][0][:value]).to eq('mak21')
|
||||||
|
@ -441,7 +482,6 @@ describe 'EPP Domain', epp: true do
|
||||||
|
|
||||||
it 'updates a domain' do
|
it 'updates a domain' do
|
||||||
Fabricate(:contact, code: 'mak21')
|
Fabricate(:contact, code: 'mak21')
|
||||||
epp_request('domains/update_add_objects.xml')
|
|
||||||
|
|
||||||
xml_params = {
|
xml_params = {
|
||||||
chg: [
|
chg: [
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
<?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:authInfo>
|
|
||||||
<domain:pw>2BARfoo</domain:pw>
|
|
||||||
</domain:authInfo>
|
|
||||||
</domain:chg>
|
|
||||||
</domain:update>
|
|
||||||
</update>
|
|
||||||
<clTRID>ABC-12345</clTRID>
|
|
||||||
</command>
|
|
||||||
</epp>
|
|
|
@ -1,22 +0,0 @@
|
||||||
<?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>ns1.example.com</domain:hostObj>
|
|
||||||
<domain:hostObj>ns2.example.com</domain:hostObj>
|
|
||||||
</domain:ns>
|
|
||||||
<domain:contact type="tech">mak21</domain:contact>
|
|
||||||
<domain:status s="clientHold"
|
|
||||||
lang="en">Payment overdue.</domain:status>
|
|
||||||
<domain:status s="clientUpdateProhibited"/>
|
|
||||||
</domain:add>
|
|
||||||
</domain:update>
|
|
||||||
</update>
|
|
||||||
<clTRID>ABC-12345</clTRID>
|
|
||||||
</command>
|
|
||||||
</epp>
|
|
|
@ -1,19 +0,0 @@
|
||||||
<?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:rem>
|
|
||||||
<domain:ns>
|
|
||||||
<domain:hostObj>ns1.example.com</domain:hostObj>
|
|
||||||
</domain:ns>
|
|
||||||
<domain:contact type="tech">mak21</domain:contact>
|
|
||||||
<domain:status s="clientHold"/>
|
|
||||||
</domain:rem>
|
|
||||||
</domain:update>
|
|
||||||
</update>
|
|
||||||
<clTRID>ABC-12345</clTRID>
|
|
||||||
</command>
|
|
||||||
</epp>
|
|
Loading…
Add table
Add a link
Reference in a new issue