mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 17:59:47 +02:00
Validateing rest of the contact requests
This commit is contained in:
parent
e99af041f1
commit
2f0b0c35d4
3 changed files with 41 additions and 0 deletions
|
@ -10,6 +10,7 @@ module Epp::ContactsHelper
|
|||
end
|
||||
|
||||
def update_contact
|
||||
#TODO add support for rem and add
|
||||
code = params_hash['epp']['command']['update']['update'][:id]
|
||||
@contact = Contact.where(code: code).first
|
||||
stamp @contact
|
||||
|
@ -78,6 +79,27 @@ module Epp::ContactsHelper
|
|||
['authInfo']])
|
||||
end
|
||||
|
||||
def validate_contact_update_request
|
||||
@ph = params_hash['epp']['command']['update']['update']
|
||||
xml_attrs_present?(@ph, [['id'] ])
|
||||
end
|
||||
|
||||
def validate_contact_delete_request
|
||||
@ph = params_hash['epp']['command']['delete']['delete']
|
||||
xml_attrs_present?(@ph, [ ['id'] ] )
|
||||
end
|
||||
|
||||
def validate_contact_check_request
|
||||
@ph = params_hash['epp']['command']['check']['check']
|
||||
xml_attrs_present?(@ph, [ ['id'] ])
|
||||
end
|
||||
|
||||
def validate_contact_info_request
|
||||
@ph = params_hash['epp']['command']['info']['info']
|
||||
xml_attrs_present?(@ph, [ ['id'] ])
|
||||
end
|
||||
|
||||
|
||||
def contact_and_address_attributes
|
||||
ph = params_hash['epp']['command'][params[:command]][params[:command]]
|
||||
ph = ph[:chg] if params[:command] == 'update'
|
||||
|
|
|
@ -6,6 +6,7 @@ describe 'EPP Contact', epp: true do
|
|||
context 'with valid user' do
|
||||
before(:each) { Fabricate(:epp_user) }
|
||||
|
||||
#Tests for the new error system
|
||||
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')
|
||||
|
@ -15,6 +16,13 @@ describe 'EPP Contact', epp: true do
|
|||
expect(response[:results][1][:msg]).to eq('Required parameter missing: authInfo')
|
||||
end
|
||||
|
||||
it "doesn't update contact with attributes missing" do
|
||||
response = epp_request('contacts/update_missing_attr.xml')
|
||||
|
||||
expect(response[:results][0][:result_code]).to eq('2003')
|
||||
expect(response[:results][0][:msg]).to eq('Required parameter missing: id')
|
||||
end
|
||||
|
||||
# incomplete
|
||||
it 'creates a contact' do
|
||||
response = epp_request('contacts/create.xml')
|
||||
|
|
11
spec/epp/requests/contacts/update_missing_attr.xml
Normal file
11
spec/epp/requests/contacts/update_missing_attr.xml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?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:update>
|
||||
</update>
|
||||
<clTRID>ABC-12345</clTRID>
|
||||
</command>
|
||||
</epp>
|
Loading…
Add table
Add a link
Reference in a new issue