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

This commit is contained in:
Martin Lensment 2014-08-06 18:04:53 +03:00
commit 218ecb3317
10 changed files with 143 additions and 38 deletions

View file

@ -29,24 +29,7 @@ describe 'EPP Contact', epp: true do
expect(Contact.count).to eq(1)
end
it 'updates a contact with same ident', pending: true do
pending 'fixing this as soon as contact#update is done'
Fabricate(:contact)
response = epp_request('contacts/create.xml')
expect(response[:result_code]).to eq('1000')
expect(response[:msg]).to eq('Command completed successfully')
expect(response[:clTRID]).to eq('ABC-12345')
expect(Contact.first.name).to eq("John Doe")
expect(Contact.first.ident_type).to eq("op")
expect(Contact.first.updated_by_id).to be 1
#nil because we fabricate, hence stamping in controller won't happen
expect(Contact.first.created_by_id).to be nil
expect(Contact.count).to eq(1)
end
#TODO tests for missing/invalid/etc ident
#TODO tests for missing/invalid/etc ident
it 'deletes contact' do
Fabricate(:contact)
@ -107,5 +90,24 @@ describe 'EPP Contact', epp: true do
expect(response[:result_code]).to eq('2201')
expect(response[:msg]).to eq('Authorization error')
end
it 'updates contact succesfully' do
Fabricate(:contact, created_by_id: 1, email: 'not_updated@test.test', code: 'sh8013')
response = epp_request('contacts/update.xml')
expect(response[:msg]).to eq('Command completed successfully')
expect(Contact.first.name).to eq('John Doe')
expect(Contact.first.email).to eq('jdoe@example.com')
end
it 'returns phone and email error' do
Fabricate(:contact, created_by_id: 1, email: 'not_updated@test.test', code: 'sh8013')
response = epp_request('contacts/update_with_errors.xml')
expect(response[:results][0][:result_code]).to eq('2005')
expect(response[:results][0][:msg]).to eq('Phone nr is invalid')
expect(response[:results][1][:result_code]).to eq('2005')
expect(response[:results][1][:msg]).to eq('Email is invalid')
end
end
end

View file

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command>
<update>
<contact:update
xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
<contact:id>sh8013</contact:id>
<contact:chg>
<contact:postalInfo type="int">
<contact:name>John Doe</contact:name>
<contact:addr>
<contact:street>123 Example Dr.</contact:street>
<contact:street>Suite 100</contact:street>
<contact:city>Dulles</contact:city>
<contact:sp>VA</contact:sp>
<contact:pc>20166-6503</contact:pc>
<contact:cc>EE</contact:cc>
</contact:addr>
</contact:postalInfo>
<contact:voice x="1234">+123.7035555555</contact:voice>
<contact:fax>+1.7035555556</contact:fax>
<contact:email>jdoe@example.com</contact:email>
<contact:ident type="op">37605030299</contact:ident>
<contact:authInfo>
<contact:pw>2fooBAR</contact:pw>
</contact:authInfo>
<contact:disclose flag="0">
<contact:voice/>
<contact:email/>
</contact:disclose>
</contact:chg>
</contact:update>
</update>
<clTRID>ABC-12345</clTRID>
</command>
</epp>

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command>
<update>
<contact:update
xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
<contact:id>sh8013</contact:id>
<contact:chg>
<contact:voice x="1234">123456798</contact:voice>
<contact:email>faulty</contact:email>
</contact:chg>
</contact:update>
</update>
<clTRID>ABC-12345</clTRID>
</command>
</epp>