mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 09:57:23 +02:00
Contact#update tests to check disclosure update
This commit is contained in:
parent
0e655bf306
commit
a9df2c82b1
2 changed files with 13 additions and 2 deletions
|
@ -7,12 +7,13 @@ module Epp::ContactsHelper
|
|||
end
|
||||
|
||||
def update_contact
|
||||
# FIXME: Update returns 2303 update multiple times
|
||||
code = params_hash['epp']['command']['update']['update'][:id]
|
||||
@contact = Contact.where(code: code).first
|
||||
if rights? && stamp(@contact) && @contact.update_attributes(contact_and_address_attributes(:update))
|
||||
render 'epp/contacts/update'
|
||||
else
|
||||
contact_exists?
|
||||
contact_exists?(code)
|
||||
handle_errors(@contact)
|
||||
end
|
||||
end
|
||||
|
@ -67,7 +68,7 @@ module Epp::ContactsHelper
|
|||
xml_attrs_present?(@ph, [['id']])
|
||||
end
|
||||
|
||||
def contact_exists?
|
||||
def contact_exists?(code)
|
||||
return true if @contact.is_a?(Contact)
|
||||
epp_errors << { code: '2303', msg: t('errors.messages.epp_obj_does_not_exist'),
|
||||
value: { obj: 'id', val: code } }
|
||||
|
|
|
@ -133,6 +133,16 @@ describe 'EPP Contact', epp: true do
|
|||
expect(response[:results][1][:result_code]).to eq('2005')
|
||||
expect(response[:results][1][:msg]).to eq('Email is invalid')
|
||||
end
|
||||
|
||||
it 'updates disclosure items' do
|
||||
Fabricate(:contact, code: 'sh8013', auth_info: '2fooBAR',
|
||||
disclosure: Fabricate(:contact_disclosure, phone:true, email:true))
|
||||
epp_request('contacts/update.xml')
|
||||
|
||||
expect(Contact.last.disclosure.phone).to eq(false)
|
||||
expect(Contact.last.disclosure.email).to eq(false)
|
||||
expect(Contact.count).to eq(1)
|
||||
end
|
||||
end
|
||||
|
||||
context 'delete command' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue