mirror of
https://github.com/internetee/registry.git
synced 2025-05-16 17:37:17 +02:00
Fix rubocop errors, add error message for transfer period #2803
This commit is contained in:
parent
6d3f2f611b
commit
aecd61670a
5 changed files with 60 additions and 11 deletions
|
@ -196,6 +196,15 @@ class Epp::DomainsController < EppController
|
|||
end
|
||||
|
||||
def validate_transfer
|
||||
# period element is disabled for now
|
||||
if params[:parsed_frame].css('period').any?
|
||||
epp_errors << {
|
||||
code: '2307',
|
||||
msg: I18n.t(:unimplemented_object_service),
|
||||
value: { obj: 'period' }
|
||||
}
|
||||
end
|
||||
|
||||
requires 'transfer > transfer'
|
||||
|
||||
@prefix = 'transfer > transfer >'
|
||||
|
|
|
@ -474,7 +474,9 @@ describe 'EPP Domain', epp: true do
|
|||
})
|
||||
|
||||
response = epp_plain_request(xml)
|
||||
response[:results][0][:msg].should == "Element '{https://epp.tld.ee/schema/domain-eis-1.0.xsd}period', attribute 'unit': [facet 'enumeration'] The value '' is not an element of the set {'y', 'm', 'd'}."
|
||||
response[:results][0][:msg].should ==
|
||||
"Element '{https://epp.tld.ee/schema/domain-eis-1.0.xsd}period', attribute 'unit': "\
|
||||
"[facet 'enumeration'] The value '' is not an element of the set {'y', 'm', 'd'}."
|
||||
response[:results][0][:result_code].should == '2001'
|
||||
|
||||
xml = domain_create_xml({
|
||||
|
@ -482,7 +484,9 @@ describe 'EPP Domain', epp: true do
|
|||
})
|
||||
|
||||
response = epp_plain_request(xml)
|
||||
response[:results][0][:msg].should == "Element '{https://epp.tld.ee/schema/domain-eis-1.0.xsd}period', attribute 'unit': [facet 'enumeration'] The value 'bla' is not an element of the set {'y', 'm', 'd'}."
|
||||
response[:results][0][:msg].should ==
|
||||
"Element '{https://epp.tld.ee/schema/domain-eis-1.0.xsd}period', attribute 'unit': "\
|
||||
"[facet 'enumeration'] The value 'bla' is not an element of the set {'y', 'm', 'd'}."
|
||||
response[:results][0][:result_code].should == '2001'
|
||||
end
|
||||
|
||||
|
@ -572,8 +576,12 @@ describe 'EPP Domain', epp: true do
|
|||
|
||||
response = epp_plain_request(xml)
|
||||
|
||||
response[:results][0][:msg].should == "Element '{urn:ietf:params:xml:ns:secDNS-1.1}pubKey': [facet 'minLength'] The value has a length of '0'; this underruns the allowed minimum length of '1'."
|
||||
response[:results][1][:msg].should == "Element '{urn:ietf:params:xml:ns:secDNS-1.1}pubKey': '' is not a valid value of the atomic type '{urn:ietf:params:xml:ns:secDNS-1.1}keyType'."
|
||||
response[:results][0][:msg].should ==
|
||||
"Element '{urn:ietf:params:xml:ns:secDNS-1.1}pubKey': [facet 'minLength'] The value has a "\
|
||||
"length of '0'; this underruns the allowed minimum length of '1'."
|
||||
response[:results][1][:msg].should ==
|
||||
"Element '{urn:ietf:params:xml:ns:secDNS-1.1}pubKey': '' is not a valid value of the atomic "\
|
||||
"type '{urn:ietf:params:xml:ns:secDNS-1.1}keyType'."
|
||||
|
||||
xml = domain_create_xml({}, {
|
||||
_anonymus: [
|
||||
|
@ -836,7 +844,8 @@ describe 'EPP Domain', epp: true do
|
|||
})
|
||||
|
||||
response = epp_plain_request(xml)
|
||||
response[:msg].should == "Element '{urn:ietf:params:xml:ns:secDNS-1.1}keyData': This element is not expected. Expected is ( {urn:ietf:params:xml:ns:secDNS-1.1}dsData )."
|
||||
response[:msg].should == "Element '{urn:ietf:params:xml:ns:secDNS-1.1}keyData': This element "\
|
||||
"is not expected. Expected is ( {urn:ietf:params:xml:ns:secDNS-1.1}dsData )."
|
||||
response[:result_code].should == '2001'
|
||||
end
|
||||
end
|
||||
|
@ -1505,7 +1514,9 @@ describe 'EPP Domain', epp: true do
|
|||
|
||||
it 'returns an error for incorrect op attribute' do
|
||||
response = epp_plain_request(domain_transfer_xml({}, 'bla'))
|
||||
response[:msg].should == "Element '{urn:ietf:params:xml:ns:epp-1.0}transfer', attribute 'op': [facet 'enumeration'] The value 'bla' is not an element of the set {'approve', 'cancel', 'query', 'reject', 'request'}."
|
||||
response[:msg].should ==
|
||||
"Element '{urn:ietf:params:xml:ns:epp-1.0}transfer', attribute 'op': [facet 'enumeration'] "\
|
||||
"The value 'bla' is not an element of the set {'approve', 'cancel', 'query', 'reject', 'request'}."
|
||||
response[:result_code].should == '2001'
|
||||
end
|
||||
|
||||
|
@ -1658,6 +1669,22 @@ describe 'EPP Domain', epp: true do
|
|||
Setting.transfer_wait_time = 0
|
||||
end
|
||||
|
||||
it 'should not transfer when period element is present' do
|
||||
pw = domain.auth_info
|
||||
xml = domain_transfer_xml({
|
||||
name: { value: domain.name },
|
||||
period: { value: '1', attrs: { unit: 'y' } },
|
||||
authInfo: { pw: { value: pw } }
|
||||
})
|
||||
|
||||
login_as :registrar2 do
|
||||
response = epp_plain_request(xml)
|
||||
response[:msg].should == 'Unimplemented object service'
|
||||
response[:result_code].should == '2307'
|
||||
response[:parsed].css('value > period').any?.should == true
|
||||
end
|
||||
end
|
||||
|
||||
### UPDATE ###
|
||||
it 'should update right away without update pending status' do
|
||||
existing_pw = domain.auth_info
|
||||
|
@ -2243,7 +2270,14 @@ describe 'EPP Domain', epp: true do
|
|||
})
|
||||
|
||||
response = epp_plain_request(xml)
|
||||
response[:results][0][:msg].should == "Element '{https://epp.tld.ee/schema/domain-eis-1.0.xsd}status', attribute 's': [facet 'enumeration'] The value 'invalidStatus' is not an element of the set {'clientDeleteProhibited', 'clientHold', 'clientRenewProhibited', 'clientTransferProhibited', 'clientUpdateProhibited', 'inactive', 'ok', 'pendingCreate', 'pendingDelete', 'pendingRenew', 'pendingTransfer', 'pendingUpdate', 'serverDeleteProhibited', 'serverHold', 'serverRenewProhibited', 'serverTransferProhibited', 'serverUpdateProhibited'}."
|
||||
response[:results][0][:msg].should ==
|
||||
"Element '{https://epp.tld.ee/schema/domain-eis-1.0.xsd}status', attribute 's': "\
|
||||
"[facet 'enumeration'] The value 'invalidStatus' is not an element of the set "\
|
||||
"{'clientDeleteProhibited', 'clientHold', 'clientRenewProhibited', "\
|
||||
"'clientTransferProhibited', 'clientUpdateProhibited', 'inactive', "\
|
||||
"'ok', 'pendingCreate', 'pendingDelete', 'pendingRenew', 'pendingTransfer', "\
|
||||
"'pendingUpdate', 'serverDeleteProhibited', 'serverHold', 'serverRenewProhibited', "\
|
||||
"'serverTransferProhibited', 'serverUpdateProhibited'}."
|
||||
response[:results][0][:result_code].should == '2001'
|
||||
end
|
||||
|
||||
|
@ -2356,7 +2390,8 @@ describe 'EPP Domain', epp: true do
|
|||
)
|
||||
|
||||
response = epp_plain_request(xml)
|
||||
response[:results][0][:msg].should == "Element '{https://epp.tld.ee/schema/domain-eis-1.0.xsd}period', attribute 'unit': [facet 'enumeration'] The value '' is not an element of the set {'y', 'm', 'd'}."
|
||||
response[:results][0][:msg].should == "Element '{https://epp.tld.ee/schema/domain-eis-1.0.xsd}period', "\
|
||||
"attribute 'unit': [facet 'enumeration'] The value '' is not an element of the set {'y', 'm', 'd'}."
|
||||
response[:results][0][:result_code].should == '2001'
|
||||
|
||||
xml = @epp_xml.domain.renew(
|
||||
|
@ -2366,7 +2401,8 @@ describe 'EPP Domain', epp: true do
|
|||
)
|
||||
|
||||
response = epp_plain_request(xml)
|
||||
response[:results][0][:msg].should == "Element '{https://epp.tld.ee/schema/domain-eis-1.0.xsd}period', attribute 'unit': [facet 'enumeration'] The value 'bla' is not an element of the set {'y', 'm', 'd'}."
|
||||
response[:results][0][:msg].should == "Element '{https://epp.tld.ee/schema/domain-eis-1.0.xsd}period', "\
|
||||
"attribute 'unit': [facet 'enumeration'] The value 'bla' is not an element of the set {'y', 'm', 'd'}."
|
||||
response[:results][0][:result_code].should == '2001'
|
||||
|
||||
Setting.days_to_renew_domain_before_expire = 90
|
||||
|
|
|
@ -87,7 +87,8 @@ describe 'EPP Poll', epp: true do
|
|||
})
|
||||
|
||||
response = epp_plain_request(xml, validate_input: false)
|
||||
response[:msg].should == "Element '{urn:ietf:params:xml:ns:epp-1.0}poll', attribute 'op': [facet 'enumeration'] The value 'bla' is not an element of the set {'ack', 'req'}."
|
||||
response[:msg].should == "Element '{urn:ietf:params:xml:ns:epp-1.0}poll', attribute 'op': "\
|
||||
"[facet 'enumeration'] The value 'bla' is not an element of the set {'ack', 'req'}."
|
||||
response[:result_code].should == '2001'
|
||||
end
|
||||
|
||||
|
|
|
@ -142,7 +142,9 @@ describe 'EPP Session', epp: true do
|
|||
newPW: { value: '' }
|
||||
), validate_input: false)
|
||||
|
||||
response[:msg].should == "Element '{urn:ietf:params:xml:ns:epp-1.0}newPW': [facet 'minLength'] The value has a length of '0'; this underruns the allowed minimum length of '6'."
|
||||
response[:msg].should ==
|
||||
"Element '{urn:ietf:params:xml:ns:epp-1.0}newPW': [facet 'minLength'] The value has a "\
|
||||
"length of '0'; this underruns the allowed minimum length of '6'."
|
||||
response[:result_code].should == '2001'
|
||||
|
||||
@api_user.reload
|
||||
|
|
|
@ -352,6 +352,7 @@ module Epp
|
|||
def domain_transfer_xml(xml_params = {}, op = 'request', custom_params = {})
|
||||
defaults = {
|
||||
name: { value: next_domain_name },
|
||||
period: nil,
|
||||
authInfo: {
|
||||
pw: { value: '98oiewslkfkd', attrs: { roid: 'citizen_1234-REP' } }
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue