Do not allow hostObj

This commit is contained in:
Martin Lensment 2014-11-10 11:17:31 +02:00
parent 952b379aaf
commit cf11f1aaf8
4 changed files with 68 additions and 11 deletions

View file

@ -263,9 +263,17 @@ describe 'EPP Domain', epp: true do
it 'validates nameserver ipv4 when in same zone as domain' do
xml = domain_create_xml({
ns: [
{ hostObj: { value: 'ns1.example.ee' } },
{ hostObj: { value: 'ns2.example.ee' } }
]
{
hostAttr: [
{ hostName: { value: 'ns1.example.ee' } }
]
},
{
hostAttr: {
hostName: { value: 'ns2.example.ee' }
}
}
],
})
response = epp_request(xml, :xml)
@ -309,7 +317,13 @@ describe 'EPP Domain', epp: true do
it 'does not create domain with too many nameservers' do
nameservers = []
14.times { |i| nameservers << { hostObj: { value: "ns#{i}.example.net" } } }
14.times do |i|
nameservers << {
hostAttr: {
hostName: { value: "ns#{i}.example.net" }
}
}
end
xml = domain_create_xml(ns: nameservers)
response = epp_request(xml, :xml)
@ -320,8 +334,16 @@ describe 'EPP Domain', epp: true do
it 'returns error when invalid nameservers are present' do
xml = domain_create_xml({
ns: [
{ hostObj: { value: 'invalid1-' } },
{ hostObj: { value: '-invalid2' } }
{
hostAttr: {
hostName: { value: 'invalid1-' }
}
},
{
hostAttr: {
hostName: { value: '-invalid2' }
}
}
]
})
@ -330,6 +352,23 @@ describe 'EPP Domain', epp: true do
expect(response[:msg]).to eq('Hostname is invalid')
end
it 'does not allow hostObj' do
xml = domain_create_xml({
ns: [
{
hostObj: { value: 'ns1.example.ee' }
},
{
hostObj: { value: 'ns2.example.ee' }
},
]
})
response = epp_request(xml, :xml)
expect(response[:result_code]).to eq('2306')
expect(response[:msg]).to eq('hostObj object is not allowed')
end
it 'creates domain with nameservers with ips' do
epp_request(domain_create_with_host_attrs, :xml)
expect(Domain.first.nameservers.count).to eq(2)