Expand on the response about registrar and nameservers

* Return website for registrar
* Return IPv4 and IPv6 addresses for nameservers
This commit is contained in:
Maciej Szlosarczyk 2018-10-03 16:34:26 +03:00
parent 28304559fd
commit 2a4995226f
No known key found for this signature in database
GPG key ID: 41D62D42D3B0D765
8 changed files with 121 additions and 25 deletions

View file

@ -16,10 +16,20 @@ shop_ns2:
airport_ns1:
hostname: ns1.bestnames.test
ipv4:
- 192.0.2.2
ipv6:
- 2001:db8::2
domain: airport
airport_ns2:
hostname: ns2.bestnames.test
ipv4:
- 192.0.2.0
- 192.0.2.3
- 192.0.2.1
ipv6:
- 2001:db8::1
domain: airport
metro_ns1:

View file

@ -11,6 +11,7 @@ bestnames:
accounting_customer_code: bestnames
language: en
billing_email: billing@example.com
website: bestnames.test
goodnames:
name: Good Names
@ -41,4 +42,4 @@ complete:
language: en
vat_no: US12345
vat_rate: 0.05
billing_email: billing@bestnames.test
billing_email: billing@bestnames.test

View file

@ -30,7 +30,7 @@ class RegistrantApiDomainsTest < ApplicationIntegrationTest
assert_equal('hospital.test', domain[:name])
assert_equal('5edda1a5-3548-41ee-8b65-6d60daf85a37', domain[:id])
assert_equal('Good Names', domain[:registrar])
assert_equal({ name: 'Good Names', website: nil }, domain[:registrar])
assert_equal([], domain[:nameservers])
assert(domain.has_key?(:locked_by_registrant_at))
end
@ -52,7 +52,7 @@ class RegistrantApiDomainsTest < ApplicationIntegrationTest
assert(array_of_domain_names.include?('hospital.test'))
array_of_domain_registrars = response_json.map { |x| x[:registrar] }
assert(array_of_domain_registrars.include?('Good Names'))
assert(array_of_domain_registrars.include?({name: 'Good Names', website: nil}))
end
def test_root_accepts_limit_and_offset_parameters

View file

@ -129,8 +129,10 @@ class RegistrantApiRegistryLocksTest < ApplicationIntegrationTest
assert_equal(200, response.status)
response_json = JSON.parse(response.body, symbolize_names: true)
assert_equal('Best Names', response_json[:registrar])
assert_equal(['ns1.bestnames.test', 'ns2.bestnames.test'].to_set,
assert_equal({ name: 'Best Names', website: 'bestnames.test' }, response_json[:registrar])
assert_equal(
[{hostname: 'ns1.bestnames.test', ipv4: ['192.0.2.1'], ipv6: ['2001:db8::1']},
{hostname: 'ns2.bestnames.test', ipv4: ['192.0.2.2'], ipv6: ['2001:db8::2']}].to_set,
response_json[:nameservers].to_set)
assert_equal(Time.zone.parse('2010-07-05'), response_json[:locked_by_registrant_at])
end

View file

@ -25,12 +25,24 @@ class SerializersRegistrantApiDomainTest < ApplicationIntegrationTest
end
def test_returns_registrar_name
assert_equal('Best Names', @json[:registrar])
assert_equal({name: 'Best Names', website: 'bestnames.test' }, @json[:registrar])
end
def test_returns_nameserver_hostnames_or_an_empty_array
expected_nameservers = ['ns1.bestnames.test', 'ns2.bestnames.test']
assert_equal(expected_nameservers.to_set, @json[:nameservers].to_set)
expected_nameserver_1 = {
hostname: 'ns1.bestnames.test',
ipv4: ['192.0.2.2'],
ipv6: ['2001:db8::2']
}
expected_nameserver_2 = {
hostname: 'ns2.bestnames.test',
ipv4: ['192.0.2.0', '192.0.2.3', '192.0.2.1'],
ipv6: ['2001:db8::1']
}
assert(@json[:nameservers].include?(expected_nameserver_1))
assert(@json[:nameservers].include?(expected_nameserver_2))
other_domain = domains(:hospital)
other_serializer = Serializers::RegistrantApi::Domain.new(other_domain)