Add dnssec info to domain info query

This commit is contained in:
Martin Lensment 2014-10-02 12:36:41 +03:00
parent 338a58a611
commit c8863df4c5
4 changed files with 65 additions and 21 deletions

View file

@ -36,6 +36,17 @@ xml.epp_head do
end
end
xml.tag!('domain:dnssec') do
@domain.dnskeys.each do |x|
xml.tag!('domain:dnskey') do
xml.tag!('domain:flags', x.flags)
xml.tag!('domain:protocol', x.protocol)
xml.tag!('domain:alg', x.alg)
xml.tag!('domain:pubKey', x.public_key)
end
end
end if @domain.dnskeys.any?
## TODO Find out what this domain:host is all about
xml.tag!('domain:clID', @domain.owner_contact_code)

View file

@ -504,6 +504,9 @@ describe 'EPP Domain', epp: true do
d = Domain.first
d.domain_statuses.build(value: DomainStatus::CLIENT_HOLD, description: 'Payment overdue.')
d.nameservers.build(hostname: 'ns1.example.com', ipv4: '192.168.1.1', ipv6: '1080:0:0:0:8:800:200C:417A')
d.dnskeys.build(flags: 257, protocol: 3, alg: 3, public_key: 'AwEAAddt2AkLfYGKgiEZB5SmIF8EvrjxNMH6HtxWEA4RJ9Ao6LCWheg8')
d.dnskeys.build(flags: 0, protocol: 3, alg: 5, public_key: '700b97b591ed27ec2590d19f06f88bba700b97b591ed27ec2590d19f')
d.save
response = epp_request(domain_info_xml, :xml)
@ -531,9 +534,20 @@ describe 'EPP Domain', epp: true do
expect(inf_data.css('hostAddr').last.text).to eq('1080:0:0:0:8:800:200C:417A')
expect(inf_data.css('crDate').text).to eq(d.created_at.to_time.utc.to_s)
expect(inf_data.css('exDate').text).to eq(d.valid_to.to_time.utc.to_s)
expect(inf_data.css('pw').text).to eq(d.auth_info)
dnskey_1 = inf_data.css('dnskey')[0]
expect(dnskey_1.css('flags').first.text).to eq('257')
expect(dnskey_1.css('protocol').first.text).to eq('3')
expect(dnskey_1.css('alg').first.text).to eq('3')
expect(dnskey_1.css('pubKey').first.text).to eq('AwEAAddt2AkLfYGKgiEZB5SmIF8EvrjxNMH6HtxWEA4RJ9Ao6LCWheg8')
dnskey_2 = inf_data.css('dnskey')[1]
expect(dnskey_2.css('flags').first.text).to eq('0')
expect(dnskey_2.css('protocol').first.text).to eq('3')
expect(dnskey_2.css('alg').first.text).to eq('5')
expect(dnskey_2.css('pubKey').first.text).to eq('700b97b591ed27ec2590d19f06f88bba700b97b591ed27ec2590d19f')
d.touch
response = epp_request(domain_info_xml, :xml)

View file

@ -16,6 +16,14 @@ describe 'EPP Helper', epp: true do
<domain:hostObj>ns2.example.net</domain:hostObj>
</domain:ns>
<domain:registrant>jd1234</domain:registrant>
<domain:dnssec>
<domain:dnskey>
<domain:flags>257</domain:flags>
<domain:protocol>3</domain:protocol>
<domain:alg>5</domain:alg>
<domain:pubKey>AwEAAddt2AkLfYGKgiEZB5SmIF8EvrjxNMH6HtxWEA4RJ9Ao6LCWheg8</domain:pubKey>
</domain:dnskey>
</domain:dnssec>
<domain:contact type="admin">sh8013</domain:contact>
<domain:contact type="tech">sh8013</domain:contact>
<domain:contact type="tech">sh801333</domain:contact>
@ -44,6 +52,14 @@ describe 'EPP Helper', epp: true do
<domain:hostObj>ns2.test.net</domain:hostObj>
</domain:ns>
<domain:registrant>32fsdaf</domain:registrant>
<domain:dnssec>
<domain:dnskey>
<domain:flags>257</domain:flags>
<domain:protocol>3</domain:protocol>
<domain:alg>5</domain:alg>
<domain:pubKey>AwEAAddt2AkLfYGKgiEZB5SmIF8EvrjxNMH6HtxWEA4RJ9Ao6LCWheg8</domain:pubKey>
</domain:dnskey>
</domain:dnssec>
<domain:contact type="admin">2323rafaf</domain:contact>
<domain:contact type="tech">3dgxx</domain:contact>
<domain:contact type="tech">345xxv</domain:contact>
@ -54,18 +70,20 @@ describe 'EPP Helper', epp: true do
</epp>
').to_s.squish
xml = domain_create_xml(
name: 'one.ee',
period_value: '345',
period_unit: 'd',
nameservers: [{ hostObj: 'ns1.test.net' }, { hostObj: 'ns2.test.net' }],
registrant: '32fsdaf',
contacts: [
{ contact_value: '2323rafaf', contact_type: 'admin' },
{ contact_value: '3dgxx', contact_type: 'tech' },
{ contact_value: '345xxv', contact_type: 'tech' }
xml = domain_create_xml({
name: { value: 'one.ee' },
period: {value: '345', attrs: { unit: 'd' } },
ns: [
{ hostObj: {value: 'ns1.test.net' } },
{ hostObj: {value: 'ns2.test.net' } }
],
registrant: { value: '32fsdaf' },
_other: [
{ contact: {value: '2323rafaf', attrs: { type: 'admin' } } },
{ contact: {value: '3dgxx', attrs: { type: 'tech' } } },
{ contact: {value: '345xxv', attrs: { type: 'tech' } } }
]
)
})
generated = Nokogiri::XML(xml).to_s.squish
expect(generated).to eq(expected)
@ -86,13 +104,14 @@ describe 'EPP Helper', epp: true do
</epp>
').to_s.squish
xml = domain_create_xml(
name: 'one.ee',
period: false,
nameservers: [],
registrant: false,
contacts: []
)
xml = domain_create_xml({
name: { value: 'one.ee' },
period: nil,
ns: nil,
registrant: nil,
_other: nil,
dnssec: nil
})
generated = Nokogiri::XML(xml).to_s.squish
expect(generated).to eq(expected)

View file

@ -58,8 +58,8 @@ module Epp
name: { value: 'example.ee' },
period: { value: '1', attrs: { unit: 'y' } },
ns: [
{ hostObj: { value: 'ns1.example.com' } },
{ hostObj: { value: 'ns2.example.com' } }
{ hostObj: { value: 'ns1.example.net' } },
{ hostObj: { value: 'ns2.example.net' } }
],
registrant: { value: 'jd1234' },
dnssec: [