mirror of
https://github.com/internetee/registry.git
synced 2025-08-01 23:42:04 +02:00
Merge branch 'experimental-live-schema-support'
This commit is contained in:
commit
48af3e77cd
65 changed files with 1346 additions and 1205 deletions
|
@ -2,7 +2,7 @@ require 'rails_helper'
|
|||
|
||||
describe 'EPP Contact', epp: true do
|
||||
before :all do
|
||||
@xsd = Nokogiri::XML::Schema(File.read('doc/schemas/contact-eis-1.0.xsd'))
|
||||
@xsd = Nokogiri::XML::Schema(File.read('lib/schemas/contact-eis-1.0.xsd'))
|
||||
@registrar1 = Fabricate(:registrar1)
|
||||
@registrar2 = Fabricate(:registrar2)
|
||||
@epp_xml = EppXml::Contact.new(cl_trid: 'ABC-12345')
|
||||
|
@ -58,34 +58,10 @@ describe 'EPP Contact', epp: true do
|
|||
end
|
||||
|
||||
it 'fails if request xml is missing' do
|
||||
response = epp_plain_request(@epp_xml.create, validate_input: false)
|
||||
response[:results][0][:msg].should ==
|
||||
'Required parameter missing: create > create > postalInfo > name [name]'
|
||||
response[:results][1][:msg].should ==
|
||||
'Required parameter missing: create > create > postalInfo > addr > street [street]'
|
||||
response[:results][2][:msg].should ==
|
||||
'Required parameter missing: create > create > postalInfo > addr > city [city]'
|
||||
response[:results][3][:msg].should ==
|
||||
'Required parameter missing: create > create > postalInfo > addr > pc [pc]'
|
||||
response[:results][4][:msg].should ==
|
||||
'Required parameter missing: create > create > postalInfo > addr > cc [cc]'
|
||||
response[:results][5][:msg].should ==
|
||||
'Required parameter missing: create > create > voice [voice]'
|
||||
response[:results][6][:msg].should ==
|
||||
'Required parameter missing: create > create > email [email]'
|
||||
response[:results][7][:msg].should ==
|
||||
'Required parameter missing: extension > extdata > ident [ident]'
|
||||
response = epp_plain_request(@epp_xml.create)
|
||||
|
||||
response[:results][0][:result_code].should == '2003'
|
||||
response[:results][1][:result_code].should == '2003'
|
||||
response[:results][2][:result_code].should == '2003'
|
||||
response[:results][3][:result_code].should == '2003'
|
||||
response[:results][4][:result_code].should == '2003'
|
||||
response[:results][5][:result_code].should == '2003'
|
||||
response[:results][6][:result_code].should == '2003'
|
||||
response[:results][7][:result_code].should == '2003'
|
||||
|
||||
response[:results].count.should == 8
|
||||
response[:results][0][:msg].should == "Element '{https://epp.tld.ee/schema/contact-eis-1.0.xsd}create': Missing child element(s). Expected is one of ( {https://epp.tld.ee/schema/contact-eis-1.0.xsd}id, {https://epp.tld.ee/schema/contact-eis-1.0.xsd}postalInfo )."
|
||||
response[:results][0][:result_code].should == '2001'
|
||||
end
|
||||
|
||||
it 'successfully creates a contact' do
|
||||
|
@ -196,10 +172,9 @@ describe 'EPP Contact', epp: true do
|
|||
attrs: { type: 'birthday', cc: 'WRONG' }
|
||||
}
|
||||
}
|
||||
response = create_request({}, extension, validate_input: false)
|
||||
response[:msg].should ==
|
||||
'Ident country code is not valid, should be in ISO_3166-1 alpha 2 format [ident]'
|
||||
response[:result_code].should == '2005'
|
||||
response = create_request({}, extension)
|
||||
response[:msg].should == "Element '{https://epp.tld.ee/schema/eis-1.0.xsd}ident', attribute 'cc': [facet 'maxLength'] The value 'WRONG' has a length of '5'; this exceeds the allowed maximum length of '2'."
|
||||
response[:result_code].should == '2001'
|
||||
end
|
||||
|
||||
it 'should return country missing' do
|
||||
|
@ -209,10 +184,9 @@ describe 'EPP Contact', epp: true do
|
|||
attrs: { type: 'birthday' }
|
||||
}
|
||||
}
|
||||
response = create_request({}, extension, validate_input: false)
|
||||
response[:msg].should ==
|
||||
'Required ident attribute missing: cc'
|
||||
response[:result_code].should == '2003'
|
||||
response = create_request({}, extension)
|
||||
response[:msg].should == "Element '{https://epp.tld.ee/schema/eis-1.0.xsd}ident': The attribute 'cc' is required but missing."
|
||||
response[:result_code].should == '2001'
|
||||
end
|
||||
|
||||
it 'should return country missing' do
|
||||
|
@ -221,10 +195,9 @@ describe 'EPP Contact', epp: true do
|
|||
value: '1990-22-12'
|
||||
}
|
||||
}
|
||||
response = create_request({}, extension, validate_input: false)
|
||||
response[:msg].should ==
|
||||
'Required ident attribute missing: type'
|
||||
response[:result_code].should == '2003'
|
||||
response = create_request({}, extension)
|
||||
response[:msg].should == "Element '{https://epp.tld.ee/schema/eis-1.0.xsd}ident': The attribute 'type' is required but missing."
|
||||
response[:result_code].should == '2001'
|
||||
end
|
||||
|
||||
it 'should add registrar prefix for code when legacy prefix present' do
|
||||
|
@ -335,15 +308,8 @@ describe 'EPP Contact', epp: true do
|
|||
end
|
||||
|
||||
it 'fails if request is invalid' do
|
||||
response = epp_plain_request(@epp_xml.update, validate_input: false)
|
||||
|
||||
response[:results][0][:msg].should ==
|
||||
'Required parameter missing: add, rem or chg'
|
||||
response[:results][0][:result_code].should == '2003'
|
||||
response[:results][1][:msg].should ==
|
||||
'Required parameter missing: update > update > id [id]'
|
||||
response[:results][1][:result_code].should == '2003'
|
||||
response[:results].count.should == 2
|
||||
response = epp_plain_request(@epp_xml.update)
|
||||
response[:results][0][:msg].should == "Element '{https://epp.tld.ee/schema/contact-eis-1.0.xsd}update': Missing child element(s). Expected is ( {https://epp.tld.ee/schema/contact-eis-1.0.xsd}id )."
|
||||
end
|
||||
|
||||
it 'returns error if obj doesnt exist' do
|
||||
|
@ -429,11 +395,11 @@ describe 'EPP Contact', epp: true do
|
|||
chg: {
|
||||
id: { value: 'notpossibletoupdate' }
|
||||
}
|
||||
}, {}, { validate_input: false }
|
||||
}, {}
|
||||
)
|
||||
|
||||
response[:msg].should == 'Object does not exist'
|
||||
response[:result_code].should == '2303'
|
||||
response[:msg].should == "Element '{https://epp.tld.ee/schema/contact-eis-1.0.xsd}id': This element is not expected."
|
||||
response[:result_code].should == '2001'
|
||||
|
||||
@contact.reload.code.should == 'FIRST0:SH8013'
|
||||
end
|
||||
|
@ -492,16 +458,16 @@ describe 'EPP Contact', epp: true do
|
|||
id: { value: 'FIRST0:SH8013' },
|
||||
add: [{
|
||||
_anonymus: [
|
||||
{ status: { value: 'Payment overdue.', attrs: { s: 'clientHold', lang: 'en' } } },
|
||||
{ status: { value: 'Payment overdue.', attrs: { s: 'clientDeleteProhibited', lang: 'en' } } },
|
||||
{ status: { value: '', attrs: { s: 'clientUpdateProhibited' } } }
|
||||
]
|
||||
}]
|
||||
})
|
||||
|
||||
response = epp_plain_request(xml, validate_input: false)
|
||||
response[:results][0][:result_code].should == '2306'
|
||||
response = epp_plain_request(xml)
|
||||
response[:results][0][:msg].should == "Parameter value policy error. Client-side object status "\
|
||||
"management not supported: status [status]"
|
||||
response[:results][0][:result_code].should == '2306'
|
||||
|
||||
Setting.client_status_editing_enabled = true
|
||||
end
|
||||
|
@ -543,6 +509,7 @@ describe 'EPP Contact', epp: true do
|
|||
end
|
||||
|
||||
it 'should honor chg value over add value when both changes same attribute' do
|
||||
pending 'It should not be possible to add voice (in add)'
|
||||
xml = @epp_xml.update({
|
||||
id: { value: 'FIRST0:SH8013' },
|
||||
add: {
|
||||
|
@ -554,7 +521,7 @@ describe 'EPP Contact', epp: true do
|
|||
}
|
||||
})
|
||||
|
||||
response = epp_plain_request(xml, validate_input: false)
|
||||
response = epp_plain_request(xml)
|
||||
response[:results][0][:msg].should == 'Command completed successfully'
|
||||
response[:results][0][:result_code].should == '1000'
|
||||
|
||||
|
@ -585,8 +552,10 @@ describe 'EPP Contact', epp: true do
|
|||
|
||||
# TODO: Update request rem block must be analyzed
|
||||
it 'should not allow to remove required attribute' do
|
||||
pending 'It should not be possible to remove or add voice (in add and rem)'
|
||||
contact = Contact.find_by(code: 'FIRST0:SH8013')
|
||||
phone = contact.phone
|
||||
# TODO: Refactor authInfo under chg block
|
||||
xml = @epp_xml.update({
|
||||
id: { value: 'FIRST0:SH8013' },
|
||||
authInfo: { pw: { value: 'password' } },
|
||||
|
@ -595,7 +564,7 @@ describe 'EPP Contact', epp: true do
|
|||
}
|
||||
})
|
||||
|
||||
response = epp_plain_request(xml, validate_input: false)
|
||||
response = epp_plain_request(xml)
|
||||
response[:results][0][:msg].should == 'Required parameter missing - phone [phone]'
|
||||
response[:results][0][:result_code].should == '2003'
|
||||
|
||||
|
@ -604,6 +573,8 @@ describe 'EPP Contact', epp: true do
|
|||
end
|
||||
|
||||
it 'should honor add over rem' do
|
||||
pending 'It should not be possible to remove or add voice (in add and rem)'
|
||||
# TODO: Refactor authInfo under chg block
|
||||
xml = @epp_xml.update({
|
||||
id: { value: 'FIRST0:SH8013' },
|
||||
authInfo: { pw: { value: 'password' } },
|
||||
|
@ -615,7 +586,7 @@ describe 'EPP Contact', epp: true do
|
|||
}
|
||||
})
|
||||
|
||||
response = epp_plain_request(xml, validate_input: false)
|
||||
response = epp_plain_request(xml)
|
||||
response[:results][0][:msg].should == 'Command completed successfully'
|
||||
response[:results][0][:result_code].should == '1000'
|
||||
|
||||
|
@ -626,6 +597,8 @@ describe 'EPP Contact', epp: true do
|
|||
end
|
||||
|
||||
it 'should honor chg over rem' do
|
||||
pending 'It should not be possible to remove or add voice (in add and rem)'
|
||||
# TODO: Refactor authInfo under chg block
|
||||
xml = @epp_xml.update({
|
||||
id: { value: 'FIRST0:SH8013' },
|
||||
authInfo: { pw: { value: 'password' } },
|
||||
|
@ -637,7 +610,7 @@ describe 'EPP Contact', epp: true do
|
|||
}
|
||||
})
|
||||
|
||||
response = epp_plain_request(xml, validate_input: false)
|
||||
response = epp_plain_request(xml)
|
||||
response[:results][0][:msg].should == 'Command completed successfully'
|
||||
response[:results][0][:result_code].should == '1000'
|
||||
|
||||
|
@ -648,6 +621,8 @@ describe 'EPP Contact', epp: true do
|
|||
end
|
||||
|
||||
it 'should honor chg over rem and add' do
|
||||
pending 'It should not be possible to remove or add voice (in add and rem)'
|
||||
# TODO: Refactor authInfo under chg block
|
||||
xml = @epp_xml.update({
|
||||
id: { value: 'FIRST0:SH8013' },
|
||||
authInfo: { pw: { value: 'password' } },
|
||||
|
@ -662,7 +637,7 @@ describe 'EPP Contact', epp: true do
|
|||
}
|
||||
})
|
||||
|
||||
response = epp_plain_request(xml, validate_input: false)
|
||||
response = epp_plain_request(xml)
|
||||
response[:results][0][:msg].should == 'Command completed successfully'
|
||||
response[:results][0][:result_code].should == '1000'
|
||||
|
||||
|
@ -673,6 +648,7 @@ describe 'EPP Contact', epp: true do
|
|||
end
|
||||
|
||||
it 'should not remove password' do
|
||||
pending 'There should be no possibility to remove pw'
|
||||
xml = @epp_xml.update({
|
||||
id: { value: 'FIRST0:SH8013' },
|
||||
authInfo: { pw: { value: 'password' } },
|
||||
|
@ -681,7 +657,7 @@ describe 'EPP Contact', epp: true do
|
|||
}
|
||||
})
|
||||
|
||||
response = epp_plain_request(xml, validate_input: false)
|
||||
response = epp_plain_request(xml)
|
||||
response[:results][0][:msg].should == 'Command completed successfully'
|
||||
response[:results][0][:result_code].should == '1000'
|
||||
|
||||
|
@ -690,21 +666,26 @@ describe 'EPP Contact', epp: true do
|
|||
end
|
||||
|
||||
it 'should return general policy error when removing org' do
|
||||
pending 'Test says it should throw error when removing org, it does not do it when removing it with chg block'
|
||||
xml = @epp_xml.update({
|
||||
id: { value: 'FIRST0:SH8013' },
|
||||
authInfo: { pw: { value: 'password' } },
|
||||
rem: {
|
||||
postalInfo: { org: { value: 'not important' } }
|
||||
chg: {
|
||||
postalInfo: {
|
||||
org: { value: '' }
|
||||
},
|
||||
authInfo: { pw: { value: 'password' } }
|
||||
}
|
||||
})
|
||||
|
||||
response = epp_plain_request(xml, validate_input: false)
|
||||
response = epp_plain_request(xml)
|
||||
response[:results][0][:msg].should ==
|
||||
'Parameter value policy error. Org must be blank: postalInfo > org [org]'
|
||||
response[:results][0][:result_code].should == '2306'
|
||||
end
|
||||
|
||||
it 'should return error when removing street' do
|
||||
pending 'Test says it tests removing street, but actually street is not removed'
|
||||
# TODO: Refactor authInfo under chg block
|
||||
xml = @epp_xml.update({
|
||||
id: { value: 'FIRST0:SH8013' },
|
||||
authInfo: { pw: { value: 'password' } },
|
||||
|
@ -715,7 +696,7 @@ describe 'EPP Contact', epp: true do
|
|||
}
|
||||
})
|
||||
|
||||
response = epp_plain_request(xml, validate_input: false)
|
||||
response = epp_plain_request(xml)
|
||||
response[:results][0][:msg].should == "Required parameter missing - name [name]"
|
||||
response[:results][0][:result_code].should == '2003'
|
||||
end
|
||||
|
@ -736,11 +717,10 @@ describe 'EPP Contact', epp: true do
|
|||
end
|
||||
|
||||
it 'fails if request is invalid' do
|
||||
response = epp_plain_request(@epp_xml.delete, validate_input: false)
|
||||
response = epp_plain_request(@epp_xml.delete)
|
||||
|
||||
response[:results][0][:msg].should ==
|
||||
'Required parameter missing: delete > delete > id [id]'
|
||||
response[:results][0][:result_code].should == '2003'
|
||||
response[:results][0][:msg].should == "Element '{https://epp.tld.ee/schema/contact-eis-1.0.xsd}delete': Missing child element(s). Expected is ( {https://epp.tld.ee/schema/contact-eis-1.0.xsd}id )."
|
||||
response[:results][0][:result_code].should == '2001'
|
||||
response[:results].count.should == 1
|
||||
end
|
||||
|
||||
|
@ -832,10 +812,10 @@ describe 'EPP Contact', epp: true do
|
|||
end
|
||||
|
||||
it 'fails if request is invalid' do
|
||||
response = epp_plain_request(@epp_xml.check, validate_input: false)
|
||||
response = epp_plain_request(@epp_xml.check)
|
||||
|
||||
response[:results][0][:msg].should == 'Required parameter missing: check > check > id [id]'
|
||||
response[:results][0][:result_code].should == '2003'
|
||||
response[:results][0][:msg].should == "Element '{https://epp.tld.ee/schema/contact-eis-1.0.xsd}check': Missing child element(s). Expected is ( {https://epp.tld.ee/schema/contact-eis-1.0.xsd}id )."
|
||||
response[:results][0][:result_code].should == '2001'
|
||||
response[:results].count.should == 1
|
||||
end
|
||||
|
||||
|
@ -887,10 +867,9 @@ describe 'EPP Contact', epp: true do
|
|||
end
|
||||
|
||||
it 'fails if request invalid' do
|
||||
response = epp_plain_request(@epp_xml.info, validate_input: false)
|
||||
response[:results][0][:msg].should ==
|
||||
'Required parameter missing: info > info > id [id]'
|
||||
response[:results][0][:result_code].should == '2003'
|
||||
response = epp_plain_request(@epp_xml.info)
|
||||
response[:results][0][:msg].should == "Element '{https://epp.tld.ee/schema/contact-eis-1.0.xsd}info': Missing child element(s). Expected is ( {https://epp.tld.ee/schema/contact-eis-1.0.xsd}id )."
|
||||
response[:results][0][:result_code].should == '2001'
|
||||
response[:results].count.should == 1
|
||||
end
|
||||
|
||||
|
@ -1013,7 +992,7 @@ describe 'EPP Contact', epp: true do
|
|||
<command>
|
||||
<check>
|
||||
<contact:check
|
||||
xmlns:contact="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd">
|
||||
xmlns:contact="https://epp.tld.ee/schema/contact-eis-1.0.xsd">
|
||||
<contact:id>FIXED:CHECK-1234</contact:id>
|
||||
<contact:id>check-4321</contact:id>
|
||||
</contact:check>
|
||||
|
@ -1029,7 +1008,7 @@ describe 'EPP Contact', epp: true do
|
|||
<command>
|
||||
<check>
|
||||
<contact:check
|
||||
xmlns:contact="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd">
|
||||
xmlns:contact="https://epp.tld.ee/schema/contact-eis-1.0.xsd">
|
||||
<contact:id>FIXED:CHECK-LEGACY</contact:id>
|
||||
<contact:id>CID:FIXED:CHECK-LEGACY</contact:id>
|
||||
</contact:check>
|
||||
|
|
|
@ -2,7 +2,7 @@ require 'rails_helper'
|
|||
|
||||
describe 'EPP Domain', epp: true do
|
||||
before(:all) do
|
||||
@xsd = Nokogiri::XML::Schema(File.read('doc/schemas/domain-eis-1.0.xsd'))
|
||||
@xsd = Nokogiri::XML::Schema(File.read('lib/schemas/domain-eis-1.0.xsd'))
|
||||
@epp_xml = EppXml.new(cl_trid: 'ABC-12345')
|
||||
@registrar1 = Fabricate(:registrar1, code: 'REGDOMAIN1')
|
||||
@registrar1.credit!({ sum: 10000 })
|
||||
|
@ -473,17 +473,17 @@ describe 'EPP Domain', epp: true do
|
|||
period: { value: '1', attrs: { unit: '' } }
|
||||
})
|
||||
|
||||
response = epp_plain_request(xml, validate_input: false)
|
||||
response[:results][0][:msg].should == 'Attribute is invalid: unit'
|
||||
response[:results][0][:result_code].should == '2306'
|
||||
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][:result_code].should == '2001'
|
||||
|
||||
xml = domain_create_xml({
|
||||
period: { value: '1', attrs: { unit: 'bla' } }
|
||||
})
|
||||
|
||||
response = epp_plain_request(xml, validate_input: false)
|
||||
response[:results][0][:msg].should == 'Attribute is invalid: unit'
|
||||
response[:results][0][:result_code].should == '2306'
|
||||
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][:result_code].should == '2001'
|
||||
end
|
||||
|
||||
it 'creates a domain with multiple dnskeys' do
|
||||
|
@ -542,7 +542,6 @@ describe 'EPP Domain', epp: true do
|
|||
end
|
||||
|
||||
it 'does not create a domain when dnskeys are invalid' do
|
||||
|
||||
xml = domain_create_xml({}, {
|
||||
_anonymus: [
|
||||
{ keyData: {
|
||||
|
@ -571,7 +570,40 @@ describe 'EPP Domain', epp: true do
|
|||
]
|
||||
})
|
||||
|
||||
response = epp_plain_request(xml, validate_input: false)
|
||||
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'."
|
||||
|
||||
xml = domain_create_xml({}, {
|
||||
_anonymus: [
|
||||
{ keyData: {
|
||||
flags: { value: '250' },
|
||||
protocol: { value: '4' },
|
||||
alg: { value: '9' },
|
||||
pubKey: { value: 'AwEAAddt2AkLfYGKgiEZB5SmIF8EvrjxNMH6HtxWEA4RJ9Ao6LCWheg8' }
|
||||
}
|
||||
},
|
||||
{
|
||||
keyData: {
|
||||
flags: { value: '1' },
|
||||
protocol: { value: '3' },
|
||||
alg: { value: '10' },
|
||||
pubKey: { value: '700b97b591ed27ec2590d19f06f88bba700b97b591ed27ec2590d19f' }
|
||||
}
|
||||
},
|
||||
{
|
||||
keyData: {
|
||||
flags: { value: '256' },
|
||||
protocol: { value: '5' },
|
||||
alg: { value: '254' },
|
||||
pubKey: { value: 'AwEAAbuFiHS4jZL7ZQKvEPBmsbceNHTVYpEVMdxz2A6YCjlZTEoAH3qK' }
|
||||
}
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
response = epp_plain_request(xml)
|
||||
|
||||
response[:results][0][:msg].should ==
|
||||
'Valid algorithms are: 3, 5, 6, 7, 8, 252, 253, 254, 255 [alg]'
|
||||
|
@ -589,10 +621,8 @@ describe 'EPP Domain', epp: true do
|
|||
response[:results][4][:msg].should == 'Valid flags are: 0, 256, 257 [flags]'
|
||||
response[:results][4][:value].should == '1'
|
||||
|
||||
response[:results][5][:msg].should == 'Public key is missing [public_key]'
|
||||
|
||||
response[:results][6][:msg].should == 'Valid protocols are: 3 [protocol]'
|
||||
response[:results][6][:value].should == '5'
|
||||
response[:results][5][:msg].should == 'Valid protocols are: 3 [protocol]'
|
||||
response[:results][5][:value].should == '5'
|
||||
end
|
||||
|
||||
it 'does not create a domain with two identical dnskeys' do
|
||||
|
@ -805,10 +835,9 @@ describe 'EPP Domain', epp: true do
|
|||
}]
|
||||
})
|
||||
|
||||
response = epp_plain_request(xml, validate_input: false)
|
||||
response[:msg].should == 'Mutually exclusive parameters: extension > create > keyData, '\
|
||||
'extension > create > dsData'
|
||||
response[:result_code].should == '2306'
|
||||
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[:result_code].should == '2001'
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1475,9 +1504,9 @@ describe 'EPP Domain', epp: true do
|
|||
end
|
||||
|
||||
it 'returns an error for incorrect op attribute' do
|
||||
response = epp_plain_request(domain_transfer_xml({}, 'bla'), validate_input: false)
|
||||
response[:msg].should == 'Parameter value range error: op'
|
||||
response[:result_code].should == '2004'
|
||||
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[:result_code].should == '2001'
|
||||
end
|
||||
|
||||
it 'creates new pw after successful transfer' do
|
||||
|
@ -2213,10 +2242,9 @@ describe 'EPP Domain', epp: true do
|
|||
]
|
||||
})
|
||||
|
||||
response = epp_plain_request(xml, validate_input: false)
|
||||
response[:results][0][:result_code].should == '2303'
|
||||
response[:results][0][:msg].should == 'Status was not found'
|
||||
response[:results][0][:value].should == 'invalidStatus'
|
||||
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][:result_code].should == '2001'
|
||||
end
|
||||
|
||||
### RENEW ###
|
||||
|
@ -2327,9 +2355,9 @@ describe 'EPP Domain', epp: true do
|
|||
period: { value: '1', attrs: { unit: '' } }
|
||||
)
|
||||
|
||||
response = epp_plain_request(xml, validate_input: false)
|
||||
response[:results][0][:msg].should == 'Attribute is invalid: unit'
|
||||
response[:results][0][:result_code].should == '2306'
|
||||
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][:result_code].should == '2001'
|
||||
|
||||
xml = @epp_xml.domain.renew(
|
||||
name: { value: domain.name },
|
||||
|
@ -2337,9 +2365,9 @@ describe 'EPP Domain', epp: true do
|
|||
period: { value: '1', attrs: { unit: 'bla' } }
|
||||
)
|
||||
|
||||
response = epp_plain_request(xml, validate_input: false)
|
||||
response[:results][0][:msg].should == 'Attribute is invalid: unit'
|
||||
response[:results][0][:result_code].should == '2306'
|
||||
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][:result_code].should == '2001'
|
||||
|
||||
Setting.days_to_renew_domain_before_expire = 90
|
||||
end
|
||||
|
@ -2692,9 +2720,9 @@ describe 'EPP Domain', epp: true do
|
|||
domain.save
|
||||
|
||||
xml = domain_info_xml(name: { value: domain.name, attrs: { hosts: 'invalid' } })
|
||||
response = epp_plain_request(xml, validate_input: false)
|
||||
response[:msg].should == 'Attribute is invalid: hosts'
|
||||
response[:result_code].should == '2306'
|
||||
response = epp_plain_request(xml)
|
||||
response[:msg].should == "Element '{https://epp.tld.ee/schema/domain-eis-1.0.xsd}name', attribute 'hosts': [facet 'enumeration'] The value 'invalid' is not an element of the set {'all', 'del', 'none', 'sub'}."
|
||||
response[:result_code].should == '2001'
|
||||
|
||||
xml = domain_info_xml(name: { value: domain.name, attrs: { hosts: 'sub' } })
|
||||
response = epp_plain_request(xml)
|
||||
|
|
|
@ -12,7 +12,7 @@ describe 'EPP Helper', epp: true do
|
|||
<command>
|
||||
<transfer op="request">
|
||||
<domain:transfer
|
||||
xmlns:domain="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd">
|
||||
xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
|
||||
<domain:name>' + dn + '</domain:name>
|
||||
<domain:authInfo>
|
||||
<domain:pw roid="citizen_1234-REP">98oiewslkfkd</domain:pw>
|
||||
|
@ -32,7 +32,7 @@ describe 'EPP Helper', epp: true do
|
|||
<command>
|
||||
<transfer op="approve">
|
||||
<domain:transfer
|
||||
xmlns:domain="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/domain-eis-1.0.xsd">
|
||||
xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
|
||||
<domain:name>one.ee</domain:name>
|
||||
<domain:authInfo>
|
||||
<domain:pw roid="askdf">test</domain:pw>
|
||||
|
|
|
@ -12,7 +12,7 @@ describe 'EPP Poll', epp: true do
|
|||
end
|
||||
|
||||
before(:all) do
|
||||
@xsd = Nokogiri::XML::Schema(File.read('doc/schemas/epp-1.0.xsd'))
|
||||
@xsd = Nokogiri::XML::Schema(File.read('lib/schemas/epp-1.0.xsd'))
|
||||
Fabricate(:api_user, username: 'registrar1', registrar: registrar1)
|
||||
Fabricate(:api_user, username: 'registrar2', registrar: registrar2)
|
||||
|
||||
|
@ -87,8 +87,8 @@ describe 'EPP Poll', epp: true do
|
|||
})
|
||||
|
||||
response = epp_plain_request(xml, validate_input: false)
|
||||
response[:msg].should == 'Parameter value range error: op'
|
||||
response[:result_code].should == '2004'
|
||||
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
|
||||
|
||||
it 'dequeues multiple messages' do
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<command>
|
||||
<create>
|
||||
<contact:create
|
||||
xmlns:contact="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd">
|
||||
xmlns:contact="https://epp.tld.ee/schema/contact-eis-1.0.xsd">
|
||||
<contact:id>loc_int</contact:id>
|
||||
<contact:postalInfo type="int">
|
||||
<contact:name>John Doe Int</contact:name>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<command>
|
||||
<delete>
|
||||
<contact:delete
|
||||
xmlns:contact="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd">
|
||||
xmlns:contact="https://epp.tld.ee/schema/contact-eis-1.0.xsd">
|
||||
<contact:id>dwa1234</contact:id>
|
||||
</contact:delete>
|
||||
</delete>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<command>
|
||||
<delete>
|
||||
<contact:delete
|
||||
xmlns:contact="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd">
|
||||
xmlns:contact="https://epp.tld.ee/schema/contact-eis-1.0.xsd">
|
||||
</contact:delete>
|
||||
</delete>
|
||||
<clTRID>ABC-12345</clTRID>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<command>
|
||||
<info>
|
||||
<contact:info
|
||||
xmlns:contact="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd">
|
||||
xmlns:contact="https://epp.tld.ee/schema/contact-eis-1.0.xsd">
|
||||
<contact:id>info-4444</contact:id>
|
||||
<contact:authInfo>
|
||||
<contact:pw>2fooBAR</contact:pw>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<command>
|
||||
<info>
|
||||
<contact:info
|
||||
xmlns:contact="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd">
|
||||
xmlns:contact="https://epp.tld.ee/schema/contact-eis-1.0.xsd">
|
||||
</contact:info>
|
||||
</info>
|
||||
<clTRID>ABC-12345</clTRID>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<command>
|
||||
<update>
|
||||
<contact:update
|
||||
xmlns:contact="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd">
|
||||
xmlns:contact="https://epp.tld.ee/schema/contact-eis-1.0.xsd">
|
||||
<contact:id>sh8013</contact:id>
|
||||
<contact:chg>
|
||||
<contact:postalInfo type="int">
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<command>
|
||||
<update>
|
||||
<contact:update
|
||||
xmlns:contact="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd">
|
||||
xmlns:contact="https://epp.tld.ee/schema/contact-eis-1.0.xsd">
|
||||
</contact:update>
|
||||
</update>
|
||||
<clTRID>ABC-12345</clTRID>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<command>
|
||||
<update>
|
||||
<contact:update
|
||||
xmlns:contact="https://raw.githubusercontent.com/internetee/registry/alpha/doc/schemas/contact-eis-1.0.xsd">
|
||||
xmlns:contact="https://epp.tld.ee/schema/contact-eis-1.0.xsd">
|
||||
<contact:id>sh8013</contact:id>
|
||||
<contact:chg>
|
||||
<contact:voice x="1234">123456798</contact:voice>
|
||||
|
|
|
@ -5,7 +5,7 @@ describe 'EPP Session', epp: true do
|
|||
@api_user = Fabricate(:gitlab_api_user)
|
||||
@epp_xml = EppXml.new(cl_trid: 'ABC-12345')
|
||||
@login_xml_cache = @epp_xml.session.login(clID: { value: 'gitlab' }, pw: { value: 'ghyt9e4fu' })
|
||||
@xsd = Nokogiri::XML::Schema(File.read('doc/schemas/epp-1.0.xsd'))
|
||||
@xsd = Nokogiri::XML::Schema(File.read('lib/schemas/epp-1.0.xsd'))
|
||||
end
|
||||
|
||||
context 'when not connected' do
|
||||
|
@ -51,7 +51,7 @@ describe 'EPP Session', epp: true do
|
|||
end
|
||||
|
||||
it 'prohibits further actions unless logged in' do
|
||||
@xsd = Nokogiri::XML::Schema(File.read('doc/schemas/domain-eis-1.0.xsd'))
|
||||
@xsd = Nokogiri::XML::Schema(File.read('lib/schemas/domain-eis-1.0.xsd'))
|
||||
response = epp_plain_request(@epp_xml.domain.info(name: { value: 'test.ee' }))
|
||||
response[:msg].should == 'You need to login first.'
|
||||
response[:result_code].should == '2002'
|
||||
|
@ -142,8 +142,8 @@ describe 'EPP Session', epp: true do
|
|||
newPW: { value: '' }
|
||||
), validate_input: false)
|
||||
|
||||
response[:msg].should == 'Password is missing [password]'
|
||||
response[:result_code].should == '2306'
|
||||
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
|
||||
@api_user.password.should == 'ghyt9e4fu'
|
||||
|
|
|
@ -45,7 +45,13 @@ feature 'Contact', type: :feature do
|
|||
visit '/registrar/contacts/new'
|
||||
current_path.should == '/registrar/contacts/new'
|
||||
|
||||
fill_in 'depp_contact_ident', with: 'bic-ident'
|
||||
fill_in 'depp_contact_ident', with: ''
|
||||
fill_in 'depp_contact_name', with: 'Business Name Ltd'
|
||||
fill_in 'depp_contact_email', with: 'example@example.com'
|
||||
fill_in 'depp_contact_street', with: 'Example street 12'
|
||||
fill_in 'depp_contact_city', with: 'Example City'
|
||||
fill_in 'depp_contact_zip', with: '123456'
|
||||
fill_in 'depp_contact_phone', with: '+372.12345678'
|
||||
click_button 'Create'
|
||||
|
||||
current_path.should == '/registrar/contacts'
|
||||
|
|
|
@ -12,6 +12,7 @@ describe ApiUser do
|
|||
@api_user.valid?
|
||||
@api_user.errors.full_messages.should match_array([
|
||||
"Password Password is missing",
|
||||
"Password is too short (minimum is 6 characters)",
|
||||
"Registrar Registrar is missing",
|
||||
"Username Username is missing",
|
||||
"Roles is missing"
|
||||
|
|
|
@ -67,15 +67,15 @@ module Epp
|
|||
|
||||
def epp_plain_request(data, *args)
|
||||
options = args.extract_options!
|
||||
validate_input = options[:validate_input] != false # true by default
|
||||
# validate_input = options[:validate_input] != false # true by default
|
||||
validate_output = options[:validate_output] != false # true by default
|
||||
|
||||
if validate_input && @xsd
|
||||
xml = Nokogiri::XML(data)
|
||||
@xsd.validate(xml).each do |error|
|
||||
fail Exception.new, error.to_s
|
||||
end
|
||||
end
|
||||
# if validate_input && @xsd
|
||||
# xml = Nokogiri::XML(data)
|
||||
# @xsd.validate(xml).each do |error|
|
||||
# fail Exception.new, error.to_s
|
||||
# end
|
||||
# end
|
||||
|
||||
res = parse_response(server.send_request(data))
|
||||
if res
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue