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

This commit is contained in:
Martin Lensment 2014-07-31 14:04:31 +03:00
commit 0f11c48ef9
3 changed files with 16 additions and 7 deletions

View file

@ -33,10 +33,10 @@ module Epp::ContactsHelper
@contact.destroy @contact.destroy
render '/epp/contacts/delete' render '/epp/contacts/delete'
rescue NoMethodError => e rescue NoMethodError => e
epp_errors << {code: '2303', msg: "Object does not exist"} epp_errors << { code: '2303', msg: t('errors.messages.epp_obj_does_not_exist') }
render '/epp/error' render '/epp/error'
rescue rescue
epp_errors << {code: '2400', msg: "Command failed"} epp_errors << {code: '2400', msg: t('errors.messages.epp_command_failed')}
render '/epp/error' render '/epp/error'
end end
end end
@ -48,7 +48,7 @@ module Epp::ContactsHelper
if @contacts.any? if @contacts.any?
render '/epp/contacts/check' render '/epp/contacts/check'
else else
epp_errors << {code: '2303', msg: "Object does not exist"} epp_errors << { code: '2303', msg: t('errors.messages.epp_obj_does_not_exist') }
render 'epp/error' render 'epp/error'
end end
end end
@ -62,7 +62,7 @@ module Epp::ContactsHelper
if @contact if @contact
render '/epp/contacts/info' render '/epp/contacts/info'
else else
epp_errors << { code: '2303', msg: 'Object does not exist' } epp_errors << { code: '2303', msg: t('errors.messages.epp_obj_does_not_exist') }
render 'epp/error' render 'epp/error'
end end
end end

View file

@ -49,3 +49,5 @@ en:
messages: messages:
epp_domain_reserved: 'Domain name is reserved or restricted' epp_domain_reserved: 'Domain name is reserved or restricted'
epp_domain_taken: 'Domain name already exists' epp_domain_taken: 'Domain name already exists'
epp_obj_does_not_exist: 'Object does not exist'
epp_command_failed: 'Command failed'

View file

@ -54,6 +54,13 @@ describe 'EPP Contact', epp: true do
response = epp_request('contacts/check.xml') response = epp_request('contacts/check.xml')
expect(response[:result_code]).to eq('1000') expect(response[:result_code]).to eq('1000')
expect(response[:msg]).to eq('Command completed successfully') expect(response[:msg]).to eq('Command completed successfully')
ids = response[:parsed].css('resData chkData id')
expect(ids[0].attributes['avail'].text).to eq('0')
expect(ids[1].attributes['avail'].text).to eq('1')
expect(ids[0].text).to eq('sh8913')
expect(ids[1].text).to eq('sh8914')
end end
@ -64,15 +71,15 @@ describe 'EPP Contact', epp: true do
end end
it 'returns info about contact' do it 'returns info about contact' do
contact = Fabricate(:contact, :name => "Johnny Awesome") Fabricate(:contact, :name => "Johnny Awesome")
Fabricate(:address) Fabricate(:address)
response = epp_request('contacts/info.xml') response = epp_request('contacts/info.xml')
contact_res = response[:parsed].css('resData chkData') contact = response[:parsed].css('resData chkData')
expect(response[:result_code]).to eq('1000') expect(response[:result_code]).to eq('1000')
expect(response[:msg]).to eq('Command completed successfully') expect(response[:msg]).to eq('Command completed successfully')
expect(contact_res.css('name').first.text).to eq('Johnny Awesome') expect(contact.css('name').first.text).to eq('Johnny Awesome')
end end
end end