mirror of
https://github.com/internetee/registry.git
synced 2025-07-25 03:58:27 +02:00
Add new element, error messages, fix tests #2565
This commit is contained in:
parent
94adc9496f
commit
bfdabaacf3
7 changed files with 77 additions and 25 deletions
|
@ -225,18 +225,39 @@ describe 'EPP Domain', epp: true do
|
|||
xml = domain_create_xml(name: { value: '1162.ee' })
|
||||
|
||||
response = epp_plain_request(xml)
|
||||
response[:result_code].should == '2304'
|
||||
response[:msg].should == 'Domain is reserved and requires correct auth info'
|
||||
response[:msg].should == 'Required parameter missing; reserved>pw element required for reserved domains'
|
||||
response[:result_code].should == '2003'
|
||||
response[:clTRID].should == 'ABC-12345'
|
||||
|
||||
xml = domain_create_xml(name: { value: '1162.ee' }, authInfo: { pw: { value: 'wrong_pw' } })
|
||||
xml = domain_create_xml({name: { value: '1162.ee' }}, {}, {
|
||||
_anonymus: [
|
||||
legalDocument: {
|
||||
value: 'dGVzdCBmYWlsCg==',
|
||||
attrs: { type: 'pdf' }
|
||||
},
|
||||
reserved: {
|
||||
pw: { value: 'wrong_pw' }
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
response = epp_plain_request(xml)
|
||||
response[:result_code].should == '2304'
|
||||
response[:msg].should == 'Domain is reserved and requires correct auth info'
|
||||
response[:msg].should == 'Invalid authorization information; invalid reserved>pw value'
|
||||
response[:result_code].should == '2202'
|
||||
end
|
||||
|
||||
it 'creates a reserved domain with correct auth info' do
|
||||
xml = domain_create_xml(name: { value: '1162.ee' }, authInfo: { pw: { value: 'abc' } })
|
||||
xml = domain_create_xml({name: { value: '1162.ee' }}, {}, {
|
||||
_anonymus: [
|
||||
legalDocument: {
|
||||
value: 'dGVzdCBmYWlsCg==',
|
||||
attrs: { type: 'pdf' }
|
||||
},
|
||||
reserved: {
|
||||
pw: { value: 'abc' }
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
response = epp_plain_request(xml)
|
||||
response[:msg].should == 'Command completed successfully'
|
||||
|
|
|
@ -24,12 +24,14 @@ feature 'ReservedDomain', type: :feature do
|
|||
page.should have_content('110.ee: testpw')
|
||||
|
||||
d.valid?.should == false
|
||||
d.errors.full_messages.should match_array(["Domain is reserved and requires correct auth info"])
|
||||
d.errors.full_messages.should match_array(
|
||||
["Required parameter missing; reserved>pw element required for reserved domains"]
|
||||
)
|
||||
|
||||
d.auth_info = 'wrongpw'
|
||||
d.reserved_pw = 'wrongpw'
|
||||
d.valid?.should == false
|
||||
|
||||
d.auth_info = 'testpw'
|
||||
d.reserved_pw = 'testpw'
|
||||
d.valid?.should == true
|
||||
d.errors.full_messages.should match_array([])
|
||||
end
|
||||
|
|
|
@ -144,7 +144,7 @@ module Epp
|
|||
end
|
||||
|
||||
# rubocop: disable Metrics/MethodLength
|
||||
def domain_create_xml(xml_params = {}, dnssec_params = {})
|
||||
def domain_create_xml(xml_params = {}, dnssec_params = {}, custom_params = {})
|
||||
defaults = {
|
||||
name: { value: next_domain_name },
|
||||
period: { value: '1', attrs: { unit: 'y' } },
|
||||
|
@ -185,7 +185,7 @@ module Epp
|
|||
|
||||
dnssec_params = dnssec_defaults.deep_merge(dnssec_params) if dnssec_params != false
|
||||
|
||||
custom_params = {
|
||||
custom_defaults = {
|
||||
_anonymus: [
|
||||
legalDocument: {
|
||||
value: 'dGVzdCBmYWlsCg==',
|
||||
|
@ -194,6 +194,8 @@ module Epp
|
|||
]
|
||||
}
|
||||
|
||||
custom_params = custom_defaults.deep_merge(custom_params) if custom_params != false
|
||||
|
||||
epp_xml = EppXml::Domain.new(cl_trid: 'ABC-12345')
|
||||
epp_xml.create(xml_params, dnssec_params, custom_params)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue