mirror of
https://github.com/internetee/registry.git
synced 2025-07-01 08:43:37 +02:00
Enable nested error messages
This commit is contained in:
parent
dbda351474
commit
01fb195104
3 changed files with 9 additions and 10 deletions
|
@ -83,14 +83,13 @@ class EppController < ApplicationController
|
|||
def requires(*selectors)
|
||||
el, missing = nil, nil
|
||||
selectors.each do |selector|
|
||||
full_selector = [@prefix, selector].join(' ')
|
||||
full_selector = [@prefix, selector].compact.join(' ')
|
||||
el = params[:parsed_frame].css(full_selector).first
|
||||
|
||||
missing = el.nil?
|
||||
|
||||
epp_errors << {
|
||||
code: '2003',
|
||||
msg: I18n.t('errors.messages.required_parameter_missing', key: el.try(:name) || selector)
|
||||
msg: I18n.t('errors.messages.required_parameter_missing', key: full_selector)
|
||||
} if missing
|
||||
end
|
||||
|
||||
|
|
|
@ -69,13 +69,13 @@ describe 'EPP Domain', epp: true do
|
|||
|
||||
response = epp_plain_request(xml, :xml)
|
||||
response[:results][0][:result_code].should == '2003'
|
||||
response[:results][0][:msg].should == 'Required parameter missing: ns'
|
||||
response[:results][0][:msg].should == 'Required parameter missing: create > create > ns'
|
||||
|
||||
response[:results][1][:result_code].should == '2003'
|
||||
response[:results][1][:msg].should == 'Required parameter missing: registrant'
|
||||
response[:results][1][:msg].should == 'Required parameter missing: create > create > registrant'
|
||||
|
||||
response[:results][2][:result_code].should == '2003'
|
||||
response[:results][2][:msg].should == 'Required parameter missing: ns > hostAttr'
|
||||
response[:results][2][:msg].should == 'Required parameter missing: create > create > ns > hostAttr'
|
||||
|
||||
response[:results][3][:result_code].should == '2003'
|
||||
response[:results][3][:msg].should == 'Required parameter missing: extension > extdata > legalDocument'
|
||||
|
@ -206,14 +206,14 @@ describe 'EPP Domain', epp: true do
|
|||
|
||||
response = epp_plain_request(xml, :xml)
|
||||
response[:results][0][:result_code].should == '2003'
|
||||
response[:results][0][:msg].should == 'Required parameter missing: registrant'
|
||||
response[:results][0][:msg].should == 'Required parameter missing: create > create > registrant'
|
||||
end
|
||||
|
||||
it 'does not create domain without nameservers' do
|
||||
xml = domain_create_xml(ns: [])
|
||||
response = epp_plain_request(xml, :xml)
|
||||
response[:result_code].should == '2003'
|
||||
response[:msg].should == 'Required parameter missing: ns > hostAttr'
|
||||
response[:msg].should == 'Required parameter missing: create > create > ns > hostAttr'
|
||||
end
|
||||
|
||||
it 'does not create domain with too many nameservers' do
|
||||
|
@ -270,7 +270,7 @@ describe 'EPP Domain', epp: true do
|
|||
|
||||
response = epp_plain_request(xml, :xml)
|
||||
response[:result_code].should == '2003'
|
||||
response[:msg].should == 'Required parameter missing: ns > hostAttr'
|
||||
response[:msg].should == 'Required parameter missing: create > create > ns > hostAttr'
|
||||
end
|
||||
|
||||
it 'creates domain with nameservers with ips' do
|
||||
|
|
|
@ -88,7 +88,7 @@ describe 'EPP Keyrelay', epp: true do
|
|||
})
|
||||
|
||||
response = epp_request(xml, :xml, :elkdata)
|
||||
response[:msg].should == 'Required parameter missing: keyData > flags'
|
||||
response[:msg].should == 'Required parameter missing: keyrelay > keyData > flags'
|
||||
|
||||
@zone.messages.queued.count.should == msg_count
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue