mirror of
https://github.com/internetee/registry.git
synced 2025-07-01 16:53:37 +02:00
updated contact#create to new attr checking
This commit is contained in:
parent
a3abfa73e5
commit
e99af041f1
3 changed files with 39 additions and 0 deletions
|
@ -67,6 +67,17 @@ module Epp::ContactsHelper
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def validate_contact_create_request
|
||||||
|
@ph = params_hash['epp']['command']['create']['create']
|
||||||
|
xml_attrs_present?(@ph, [['id'],
|
||||||
|
['postalInfo'],
|
||||||
|
['postalInfo', 'name'],
|
||||||
|
['postalInfo', 'addr'],
|
||||||
|
['postalInfo', 'addr', 'city'],
|
||||||
|
['postalInfo', 'addr', 'cc'],
|
||||||
|
['authInfo']])
|
||||||
|
end
|
||||||
|
|
||||||
def contact_and_address_attributes
|
def contact_and_address_attributes
|
||||||
ph = params_hash['epp']['command'][params[:command]][params[:command]]
|
ph = params_hash['epp']['command'][params[:command]][params[:command]]
|
||||||
ph = ph[:chg] if params[:command] == 'update'
|
ph = ph[:chg] if params[:command] == 'update'
|
||||||
|
|
|
@ -6,6 +6,15 @@ describe 'EPP Contact', epp: true do
|
||||||
context 'with valid user' do
|
context 'with valid user' do
|
||||||
before(:each) { Fabricate(:epp_user) }
|
before(:each) { Fabricate(:epp_user) }
|
||||||
|
|
||||||
|
it "doesn't create contact with attributes missing" do
|
||||||
|
response = epp_request('contacts/create_missing_attr.xml')
|
||||||
|
expect(response[:results][0][:result_code]).to eq('2003')
|
||||||
|
expect(response[:results][1][:result_code]).to eq('2003')
|
||||||
|
|
||||||
|
expect(response[:results][0][:msg]).to eq('Required parameter missing: cc')
|
||||||
|
expect(response[:results][1][:msg]).to eq('Required parameter missing: authInfo')
|
||||||
|
end
|
||||||
|
|
||||||
# incomplete
|
# incomplete
|
||||||
it 'creates a contact' do
|
it 'creates a contact' do
|
||||||
response = epp_request('contacts/create.xml')
|
response = epp_request('contacts/create.xml')
|
||||||
|
|
19
spec/epp/requests/contacts/create_missing_attr.xml
Normal file
19
spec/epp/requests/contacts/create_missing_attr.xml
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||||
|
<command>
|
||||||
|
<create>
|
||||||
|
<contact:create
|
||||||
|
xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
|
||||||
|
<contact:id>sh8013</contact:id>
|
||||||
|
<contact:postalInfo type="int">
|
||||||
|
<contact:name>John Doe</contact:name>
|
||||||
|
<contact:addr>
|
||||||
|
<contact:city>Dulles</contact:city>
|
||||||
|
</contact:addr>
|
||||||
|
</contact:postalInfo>
|
||||||
|
<contact:email>jdoe@example.com</contact:email>
|
||||||
|
</contact:create>
|
||||||
|
</create>
|
||||||
|
<clTRID>ABC-12345</clTRID>
|
||||||
|
</command>
|
||||||
|
</epp>
|
Loading…
Add table
Add a link
Reference in a new issue