diff --git a/doc/registrant-api/v1/domain.md b/doc/registrant-api/v1/domain.md index ec32772df..eeb1bfccc 100644 --- a/doc/registrant-api/v1/domain.md +++ b/doc/registrant-api/v1/domain.md @@ -17,58 +17,94 @@ Returns domains of the current registrant. HTTP/1.1 200 Content-Type: application/json -{ - [ - { - "id": "98d1083a-8863-4153-93e4-caee4a013535", - "name": "domain0.ee", - "registrar": { - "name": "Best Names", - "website": "example.com" +[ + { + "id":"98d1083a-8863-4153-93e4-caee4a013535", + "name":"domain0.ee", + "registrar":{ + "name":"Best Names", + "website":"example.com" + }, + "valid_to":"2016-09-09T09:11:14.861Z", + "registered_at":"2015-09-09T09:11:14.861Z", + "registrant":{ + "name":"John Smith", + "id":"acadf23e-47c4-4606-8f67-76e071a1cca2" + }, + "admin_contacts":[ + { + "name":"John Smith", + "id":"62015e7d-42c8-4d68-8164-e9b71680fd95" }, - "registered_at": "2015-09-09T09:11:14.861Z", - "valid_to": "2016-09-09T09:11:14.861Z", - "registrant_id": 1, - "transfer_code": "98oiewslkfkd", - "created_at": "2015-09-09T09:11:14.861Z", - "updated_at": "2015-09-09T09:11:14.860Z", - "name_dirty": "domain0.ee", - "name_puny": "domain0.ee", - "period": 1, - "period_unit": "y", - "creator_str": null, - "updator_str": null, - "legacy_id": null, - "legacy_registrar_id": null, - "legacy_registrant_id": null, - "outzone_at": "2016-09-24T09:11:14.861Z", - "delete_at": "2016-10-24T09:11:14.861Z", - "registrant_verification_asked_at": null, - "registrant_verification_token": null, - "locked_by_registrant_at": "2015-09-09T09:11:14.861Z", - "pending_json": {}, - "force_delete_at": null, - "statuses": [ - "ok" - ], - "nameservers": [ - { - "hostname": "ns1.bestnames.test", - "ipv4": ["173.245.58.41"], - "ipv6": ["2400:cb00:2049:1::adf5:3a33"] - }, - { - "hostname": "ns1.bestnames.test", - "ipv4": ["173.245.58.51"], - "ipv6": ["2400:cb00:2049:1::adf5:3b29"] - }, - ], - "reserved": false, - "status_notes": {}, - "statuses_backup": [] - } - ] -} + { + "name":"William Smith", + "id":"a041c5b6-7772-4fac-83cd-fbce3b2c8867" + } + ], + "tech_contacts":[ + { + "name":"John Smith", + "id":"62015e7d-42c8-4d68-8164-e9b71680fd95" + }, + { + "name":"William Smith", + "id":"a041c5b6-7772-4fac-83cd-fbce3b2c8867" + } + ], + "transfer_code":"98oiewslkfkd", + "created_at":"2015-09-09T09:11:14.861Z", + "updated_at":"2015-09-09T09:11:14.860Z", + "name_dirty":"domain0.ee", + "name_puny":"domain0.ee", + "period":1, + "period_unit":"y", + "creator_str":null, + "updator_str":null, + "legacy_id":null, + "legacy_registrar_id":null, + "legacy_registrant_id":null, + "outzone_at":"2016-09-24T09:11:14.861Z", + "delete_at":"2016-10-24T09:11:14.861Z", + "registrant_verification_asked_at":null, + "registrant_verification_token":null, + "locked_by_registrant_at":"2015-09-09T09:11:14.861Z", + "pending_json":{ + + }, + "force_delete_at":null, + "statuses":[ + "ok" + ], + "nameservers":[ + { + "hostname":"ns1.bestnames.test", + "ipv4":[ + "173.245.58.41" + ], + "ipv6":[ + "2400:cb00:2049:1::adf5:3a33" + ] + }, + { + "hostname":"ns1.bestnames.test", + "ipv4":[ + "173.245.58.51" + ], + "ipv6":[ + "2400:cb00:2049:1::adf5:3b29" + ] + }, + + ], + "reserved":false, + "status_notes":{ + + }, + "statuses_backup":[ + + ] + } +] ``` #### Request @@ -97,58 +133,94 @@ Content-Type: application/json HTTP/1.1 200 Content-Type: application/json -{ - [ - { - "id": "98d1083a-8863-4153-93e4-caee4a013535", - "name": "domain0.ee", - "registrar": { - "name": "Best Names", - "website": "example.com" +[ + { + "id":"98d1083a-8863-4153-93e4-caee4a013535", + "name":"domain0.ee", + "registrar":{ + "name":"Best Names", + "website":"example.com" + }, + "valid_to":"2016-09-09T09:11:14.861Z", + "registered_at":"2015-09-09T09:11:14.861Z", + "registrant":{ + "name":"John Smith", + "id":"acadf23e-47c4-4606-8f67-76e071a1cca2" + }, + "admin_contacts":[ + { + "name":"John Smith", + "id":"62015e7d-42c8-4d68-8164-e9b71680fd95" }, - "valid_to": "2016-09-09T09:11:14.861Z", - "registered_at": "2015-09-09T09:11:14.861Z", - "registrant_id": 1, - "transfer_code": "98oiewslkfkd", - "created_at": "2015-09-09T09:11:14.861Z", - "updated_at": "2015-09-09T09:11:14.860Z", - "name_dirty": "domain0.ee", - "name_puny": "domain0.ee", - "period": 1, - "period_unit": "y", - "creator_str": null, - "updator_str": null, - "legacy_id": null, - "legacy_registrar_id": null, - "legacy_registrant_id": null, - "outzone_at": "2016-09-24T09:11:14.861Z", - "delete_at": "2016-10-24T09:11:14.861Z", - "registrant_verification_asked_at": null, - "registrant_verification_token": null, - "locked_by_registrant_at": "2015-09-09T09:11:14.861Z", - "pending_json": {}, - "force_delete_at": null, - "statuses": [ - "ok" - ], - "nameservers": [ - { - "hostname": "ns1.bestnames.test", - "ipv4": ["173.245.58.41"], - "ipv6": ["2400:cb00:2049:1::adf5:3a33"] - }, - { - "hostname": "ns1.bestnames.test", - "ipv4": ["173.245.58.51"], - "ipv6": ["2400:cb00:2049:1::adf5:3b29"] - }, - ], - "reserved": false, - "status_notes": {}, - "statuses_backup": [] - } - ] -} + { + "name":"William Smith", + "id":"a041c5b6-7772-4fac-83cd-fbce3b2c8867" + } + ], + "tech_contacts":[ + { + "name":"John Smith", + "id":"62015e7d-42c8-4d68-8164-e9b71680fd95" + }, + { + "name":"William Smith", + "id":"a041c5b6-7772-4fac-83cd-fbce3b2c8867" + } + ], + "transfer_code":"98oiewslkfkd", + "created_at":"2015-09-09T09:11:14.861Z", + "updated_at":"2015-09-09T09:11:14.860Z", + "name_dirty":"domain0.ee", + "name_puny":"domain0.ee", + "period":1, + "period_unit":"y", + "creator_str":null, + "updator_str":null, + "legacy_id":null, + "legacy_registrar_id":null, + "legacy_registrant_id":null, + "outzone_at":"2016-09-24T09:11:14.861Z", + "delete_at":"2016-10-24T09:11:14.861Z", + "registrant_verification_asked_at":null, + "registrant_verification_token":null, + "locked_by_registrant_at":"2015-09-09T09:11:14.861Z", + "pending_json":{ + + }, + "force_delete_at":null, + "statuses":[ + "ok" + ], + "nameservers":[ + { + "hostname":"ns1.bestnames.test", + "ipv4":[ + "173.245.58.41" + ], + "ipv6":[ + "2400:cb00:2049:1::adf5:3a33" + ] + }, + { + "hostname":"ns1.bestnames.test", + "ipv4":[ + "173.245.58.51" + ], + "ipv6":[ + "2400:cb00:2049:1::adf5:3b29" + ] + }, + + ], + "reserved":false, + "status_notes":{ + + }, + "statuses_backup":[ + + ] + } +] ``` ## GET api/v1/registrant/domains/$UUID @@ -171,52 +243,89 @@ HTTP/1.1 200 Content-Type: application/json { - "id": "98d1083a-8863-4153-93e4-caee4a013535", - "name": "domain0.ee", - "registrar": { - "name": "Best Names", - "website": "example.com" + "id":"98d1083a-8863-4153-93e4-caee4a013535", + "name":"domain0.ee", + "registrar":{ + "name":"Best Names", + "website":"example.com" }, - "registered_at": "2015-09-09T09:11:14.861Z", - "valid_to": "2016-09-09T09:11:14.861Z", - "registrant_id": 1, - "transfer_code": "98oiewslkfkd", - "created_at": "2015-09-09T09:11:14.861Z", - "updated_at": "2015-09-09T09:11:14.860Z", - "name_dirty": "domain0.ee", - "name_puny": "domain0.ee", - "period": 1, - "period_unit": "y", - "creator_str": null, - "updator_str": null, - "legacy_id": null, - "legacy_registrar_id": null, - "legacy_registrant_id": null, - "outzone_at": "2016-09-24T09:11:14.861Z", - "delete_at": "2016-10-24T09:11:14.861Z", - "registrant_verification_asked_at": null, - "registrant_verification_token": null, - "locked_by_registrant_at": "2015-09-09T09:11:14.861Z", - "pending_json": {}, - "force_delete_at": null, - "statuses": [ + "valid_to":"2016-09-09T09:11:14.861Z", + "registered_at":"2015-09-09T09:11:14.861Z", + "registrant":{ + "name":"John Smith", + "id":"acadf23e-47c4-4606-8f67-76e071a1cca2" + }, + "admin_contacts":[ + { + "name":"John Smith", + "id":"62015e7d-42c8-4d68-8164-e9b71680fd95" + }, + { + "name":"William Smith", + "id":"a041c5b6-7772-4fac-83cd-fbce3b2c8867" + } + ], + "tech_contacts":[ + { + "name":"John Smith", + "id":"62015e7d-42c8-4d68-8164-e9b71680fd95" + }, + { + "name":"William Smith", + "id":"a041c5b6-7772-4fac-83cd-fbce3b2c8867" + } + ], + "transfer_code":"98oiewslkfkd", + "created_at":"2015-09-09T09:11:14.861Z", + "updated_at":"2015-09-09T09:11:14.860Z", + "name_dirty":"domain0.ee", + "name_puny":"domain0.ee", + "period":1, + "period_unit":"y", + "creator_str":null, + "updator_str":null, + "legacy_id":null, + "legacy_registrar_id":null, + "legacy_registrant_id":null, + "outzone_at":"2016-09-24T09:11:14.861Z", + "delete_at":"2016-10-24T09:11:14.861Z", + "registrant_verification_asked_at":null, + "registrant_verification_token":null, + "locked_by_registrant_at":"2015-09-09T09:11:14.861Z", + "pending_json":{ + + }, + "force_delete_at":null, + "statuses":[ "ok" ], - "nameservers": [ + "nameservers":[ { - "hostname": "ns1.bestnames.test", - "ipv4": ["173.245.58.41"], - "ipv6": ["2400:cb00:2049:1::adf5:3a33"] + "hostname":"ns1.bestnames.test", + "ipv4":[ + "173.245.58.41" + ], + "ipv6":[ + "2400:cb00:2049:1::adf5:3a33" + ] }, { - "hostname": "ns1.bestnames.test", - "ipv4": ["173.245.58.51"], - "ipv6": ["2400:cb00:2049:1::adf5:3b29"] - }, + "hostname":"ns1.bestnames.test", + "ipv4":[ + "173.245.58.51" + ], + "ipv6":[ + "2400:cb00:2049:1::adf5:3b29" + ] + } ], - "reserved": false, - "status_notes": {}, - "statuses_backup": [] + "reserved":false, + "status_notes":{ + + }, + "statuses_backup":[ + + ] } ``` diff --git a/doc/registrant-api/v1/registry_lock.md b/doc/registrant-api/v1/registry_lock.md index 1b0dd828b..553c7b28e 100644 --- a/doc/registrant-api/v1/registry_lock.md +++ b/doc/registrant-api/v1/registry_lock.md @@ -19,54 +19,91 @@ HTTP/1.1 200 Content-Type: application/json { - "id": "98d1083a-8863-4153-93e4-caee4a013535", - "name": "domain0.ee", - "registrar": { - "name": "Best Names", - "website": "example.com" + "id":"98d1083a-8863-4153-93e4-caee4a013535", + "name":"domain0.ee", + "registrar":{ + "name":"Best Names", + "website":"example.com" }, - "registered_at": "2015-09-09T09:11:14.861Z", - "valid_to": "2016-09-09T09:11:14.861Z", - "registrant_id": 1, - "transfer_code": "98oiewslkfkd", - "created_at": "2015-09-09T09:11:14.861Z", - "updated_at": "2015-09-09T09:11:14.860Z", - "name_dirty": "domain0.ee", - "name_puny": "domain0.ee", - "period": 1, - "period_unit": "y", - "creator_str": null, - "updator_str": null, - "legacy_id": null, - "legacy_registrar_id": null, - "legacy_registrant_id": null, - "outzone_at": "2016-09-24T09:11:14.861Z", - "delete_at": "2016-10-24T09:11:14.861Z", - "registrant_verification_asked_at": null, - "registrant_verification_token": null, - "locked_by_registrant_at": "2015-09-09T09:11:14.861Z", - "pending_json": {}, - "force_delete_at": null, - "statuses": [ + "registrant":{ + "name":"John Smith", + "id":"acadf23e-47c4-4606-8f67-76e071a1cca2" + }, + "admin_contacts":[ + { + "name":"John Smith", + "id":"62015e7d-42c8-4d68-8164-e9b71680fd95" + }, + { + "name":"William Smith", + "id":"a041c5b6-7772-4fac-83cd-fbce3b2c8867" + } + ], + "tech_contacts":[ + { + "name":"John Smith", + "id":"62015e7d-42c8-4d68-8164-e9b71680fd95" + }, + { + "name":"William Smith", + "id":"a041c5b6-7772-4fac-83cd-fbce3b2c8867" + } + ], + "registered_at":"2015-09-09T09:11:14.861Z", + "valid_to":"2016-09-09T09:11:14.861Z", + "transfer_code":"98oiewslkfkd", + "created_at":"2015-09-09T09:11:14.861Z", + "updated_at":"2015-09-09T09:11:14.860Z", + "name_dirty":"domain0.ee", + "name_puny":"domain0.ee", + "period":1, + "period_unit":"y", + "creator_str":null, + "updator_str":null, + "legacy_id":null, + "legacy_registrar_id":null, + "legacy_registrant_id":null, + "outzone_at":"2016-09-24T09:11:14.861Z", + "delete_at":"2016-10-24T09:11:14.861Z", + "registrant_verification_asked_at":null, + "registrant_verification_token":null, + "locked_by_registrant_at":"2015-09-09T09:11:14.861Z", + "pending_json":{ + + }, + "force_delete_at":null, + "statuses":[ "serverUpdateProhibited", "serverDeleteProhibited", "serverTransferProhibited" ], - "nameservers": [ + "nameservers":[ { - "hostname": "ns1.bestnames.test", - "ipv4": ["173.245.58.41"], - "ipv6": ["2400:cb00:2049:1::adf5:3a33"] + "hostname":"ns1.bestnames.test", + "ipv4":[ + "173.245.58.41" + ], + "ipv6":[ + "2400:cb00:2049:1::adf5:3a33" + ] }, { - "hostname": "ns1.bestnames.test", - "ipv4": ["173.245.58.51"], - "ipv6": ["2400:cb00:2049:1::adf5:3b29"] - }, + "hostname":"ns1.bestnames.test", + "ipv4":[ + "173.245.58.51" + ], + "ipv6":[ + "2400:cb00:2049:1::adf5:3b29" + ] + } ], - "reserved": false, - "status_notes": {}, - "statuses_backup": [] + "reserved":false, + "status_notes":{ + + }, + "statuses_backup":[ + + ] } ``` @@ -127,52 +164,89 @@ HTTP/1.1 200 Content-Type: application/json { - "id": "98d1083a-8863-4153-93e4-caee4a013535", - "name": "domain0.ee", - "registrar": { - "name": "Best Names", - "website": "example.com" + "id":"98d1083a-8863-4153-93e4-caee4a013535", + "name":"domain0.ee", + "registrar":{ + "name":"Best Names", + "website":"example.com" }, - "registered_at": "2015-09-09T09:11:14.861Z", - "valid_to": "2016-09-09T09:11:14.861Z", - "registrant_id": 1, - "transfer_code": "98oiewslkfkd", - "created_at": "2015-09-09T09:11:14.861Z", - "updated_at": "2015-09-09T09:11:14.860Z", - "name_dirty": "domain0.ee", - "name_puny": "domain0.ee", - "period": 1, - "period_unit": "y", - "creator_str": null, - "updator_str": null, - "legacy_id": null, - "legacy_registrar_id": null, - "legacy_registrant_id": null, - "outzone_at": "2016-09-24T09:11:14.861Z", - "delete_at": "2016-10-24T09:11:14.861Z", - "registrant_verification_asked_at": null, - "registrant_verification_token": null, - "locked_by_registrant_at": null, - "pending_json": {}, - "force_delete_at": null, - "statuses": [ + "registered_at":"2015-09-09T09:11:14.861Z", + "valid_to":"2016-09-09T09:11:14.861Z", + "registrant":{ + "name":"John Smith", + "id":"acadf23e-47c4-4606-8f67-76e071a1cca2" + }, + "admin_contacts":[ + { + "name":"John Smith", + "id":"62015e7d-42c8-4d68-8164-e9b71680fd95" + }, + { + "name":"William Smith", + "id":"a041c5b6-7772-4fac-83cd-fbce3b2c8867" + } + ], + "tech_contacts":[ + { + "name":"John Smith", + "id":"62015e7d-42c8-4d68-8164-e9b71680fd95" + }, + { + "name":"William Smith", + "id":"a041c5b6-7772-4fac-83cd-fbce3b2c8867" + } + ], + "transfer_code":"98oiewslkfkd", + "created_at":"2015-09-09T09:11:14.861Z", + "updated_at":"2015-09-09T09:11:14.860Z", + "name_dirty":"domain0.ee", + "name_puny":"domain0.ee", + "period":1, + "period_unit":"y", + "creator_str":null, + "updator_str":null, + "legacy_id":null, + "legacy_registrar_id":null, + "legacy_registrant_id":null, + "outzone_at":"2016-09-24T09:11:14.861Z", + "delete_at":"2016-10-24T09:11:14.861Z", + "registrant_verification_asked_at":null, + "registrant_verification_token":null, + "locked_by_registrant_at":null, + "pending_json":{ + + }, + "force_delete_at":null, + "statuses":[ "ok" ], - "nameservers": [ + "nameservers":[ { - "hostname": "ns1.bestnames.test", - "ipv4": ["173.245.58.41"], - "ipv6": ["2400:cb00:2049:1::adf5:3a33"] + "hostname":"ns1.bestnames.test", + "ipv4":[ + "173.245.58.41" + ], + "ipv6":[ + "2400:cb00:2049:1::adf5:3a33" + ] }, { - "hostname": "ns1.bestnames.test", - "ipv4": ["173.245.58.51"], - "ipv6": ["2400:cb00:2049:1::adf5:3b29"] - }, + "hostname":"ns1.bestnames.test", + "ipv4":[ + "173.245.58.51" + ], + "ipv6":[ + "2400:cb00:2049:1::adf5:3b29" + ] + } ], - "reserved": false, - "status_notes": {}, - "statuses_backup": [] + "reserved":false, + "status_notes":{ + + }, + "statuses_backup":[ + + ] } ``` diff --git a/lib/serializers/registrant_api/domain.rb b/lib/serializers/registrant_api/domain.rb index 5a91dcde8..d6adf61ee 100644 --- a/lib/serializers/registrant_api/domain.rb +++ b/lib/serializers/registrant_api/domain.rb @@ -9,49 +9,71 @@ module Serializers def to_json { - id: @domain.uuid, - name: @domain.name, + id: domain.uuid, + name: domain.name, registrar: { - name: @domain.registrar.name, - website: @domain.registrar.website, + name: domain.registrar.name, + website: domain.registrar.website, }, - registered_at: @domain.registered_at, - valid_to: @domain.valid_to, - created_at: @domain.created_at, - updated_at: @domain.updated_at, - registrant: @domain.registrant_name, - transfer_code: @domain.transfer_code, - name_dirty: @domain.name_dirty, - name_puny: @domain.name_puny, - period: @domain.period, - period_unit: @domain.period_unit, - creator_str: @domain.creator_str, - updator_str: @domain.updator_str, - legacy_id: @domain.legacy_id, - legacy_registrar_id: @domain.legacy_registrar_id, - legacy_registrant_id: @domain.legacy_registrant_id, - outzone_at: @domain.outzone_at, - delete_at: @domain.delete_at, - registrant_verification_asked_at: @domain.registrant_verification_asked_at, - registrant_verification_token: @domain.registrant_verification_token, - pending_json: @domain.pending_json, - force_delete_at: @domain.force_delete_at, - statuses: @domain.statuses, - locked_by_registrant_at: @domain.locked_by_registrant_at, - reserved: @domain.reserved, - status_notes: @domain.status_notes, + registered_at: domain.registered_at, + valid_to: domain.valid_to, + created_at: domain.created_at, + updated_at: domain.updated_at, + registrant: { + name: domain.registrant.name, + id: domain.registrant.uuid, + }, + tech_contacts: contacts(:tech), + admin_contacts: contacts(:admin), + transfer_code: domain.transfer_code, + name_dirty: domain.name_dirty, + name_puny: domain.name_puny, + period: domain.period, + period_unit: domain.period_unit, + creator_str: domain.creator_str, + updator_str: domain.updator_str, + legacy_id: domain.legacy_id, + legacy_registrar_id: domain.legacy_registrar_id, + legacy_registrant_id: domain.legacy_registrant_id, + outzone_at: domain.outzone_at, + delete_at: domain.delete_at, + registrant_verification_asked_at: domain.registrant_verification_asked_at, + registrant_verification_token: domain.registrant_verification_token, + pending_json: domain.pending_json, + force_delete_at: domain.force_delete_at, + statuses: domain.statuses, + locked_by_registrant_at: domain.locked_by_registrant_at, + reserved: domain.reserved, + status_notes: domain.status_notes, nameservers: nameservers, } end private - def nameservers - array_of_nameservers = Array.new + def contacts(type) + contact_pool = begin + if type == :tech + domain.tech_contacts + elsif type == :admin + domain.admin_contacts + end + end - @domain.nameservers.map do |nameserver| - array_of_nameservers.push({ hostname: nameserver.hostname, ipv4: nameserver.ipv4, - ipv6: nameserver.ipv6 }) + array_of_contacts = [] + contact_pool.map do |contact| + array_of_contacts.push(name: contact.name, id: contact.uuid) + end + + array_of_contacts + end + + def nameservers + array_of_nameservers = [] + + domain.nameservers.map do |nameserver| + array_of_nameservers.push(hostname: nameserver.hostname, ipv4: nameserver.ipv4, + ipv6: nameserver.ipv6) end array_of_nameservers diff --git a/test/integration/api/registrant/registrant_api_domains_test.rb b/test/integration/api/registrant/registrant_api_domains_test.rb index 51ca403b0..9720373a1 100644 --- a/test/integration/api/registrant/registrant_api_domains_test.rb +++ b/test/integration/api/registrant/registrant_api_domains_test.rb @@ -30,6 +30,11 @@ class RegistrantApiDomainsTest < ApplicationIntegrationTest assert_equal('hospital.test', domain[:name]) assert_equal('5edda1a5-3548-41ee-8b65-6d60daf85a37', domain[:id]) + assert_equal({name: 'John', id: 'eb2f2766-b44c-4e14-9f16-32ab1a7cb957'}, domain[:registrant]) + assert_equal([{name: 'John', id: 'eb2f2766-b44c-4e14-9f16-32ab1a7cb957'}], + domain[:admin_contacts]) + assert_equal([{name: 'John', id: 'eb2f2766-b44c-4e14-9f16-32ab1a7cb957'}], + domain[:tech_contacts]) assert_equal({ name: 'Good Names', website: nil }, domain[:registrar]) assert_equal([], domain[:nameservers]) assert(domain.has_key?(:locked_by_registrant_at)) diff --git a/test/integration/api/registrant/registrant_api_registry_locks_test.rb b/test/integration/api/registrant/registrant_api_registry_locks_test.rb index b028acc90..d35952a73 100644 --- a/test/integration/api/registrant/registrant_api_registry_locks_test.rb +++ b/test/integration/api/registrant/registrant_api_registry_locks_test.rb @@ -130,6 +130,11 @@ class RegistrantApiRegistryLocksTest < ApplicationIntegrationTest response_json = JSON.parse(response.body, symbolize_names: true) assert_equal({ name: 'Best Names', website: 'bestnames.test' }, response_json[:registrar]) + assert_equal({name: 'John', id: 'eb2f2766-b44c-4e14-9f16-32ab1a7cb957'}, response_json[:registrant]) + assert_equal([{name: 'Jane', id: '9db3de62-2414-4487-bee2-d5c155567768'}], response_json[:admin_contacts]) + assert_equal([{name: 'William', id: '0aa54704-d6f7-4ca9-b8ca-2827d9a4e4eb'}, + {name: 'Acme Ltd', id: 'f1dd365c-5be9-4b3d-a44e-3fa002465e4d'}], + response_json[:tech_contacts]) 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, diff --git a/test/lib/serializers/registrant_api/domain_test.rb b/test/lib/serializers/registrant_api/domain_test.rb index 2408283be..bddb0efd7 100644 --- a/test/lib/serializers/registrant_api/domain_test.rb +++ b/test/lib/serializers/registrant_api/domain_test.rb @@ -28,6 +28,20 @@ class SerializersRegistrantApiDomainTest < ApplicationIntegrationTest assert_equal({name: 'Best Names', website: 'bestnames.test' }, @json[:registrar]) end + def test_returns_registrant_name_and_uuid + assert_equal({name: 'John', id: 'eb2f2766-b44c-4e14-9f16-32ab1a7cb957'}, + @json[:registrant]) + end + + def test_returns_contacts_name_and_uuid + assert_equal([{name: 'John', id: 'eb2f2766-b44c-4e14-9f16-32ab1a7cb957'}, + {name: 'William', id: '0aa54704-d6f7-4ca9-b8ca-2827d9a4e4eb'}].to_set, + @json[:admin_contacts].to_set) + + assert_equal([{name: 'William', id: '0aa54704-d6f7-4ca9-b8ca-2827d9a4e4eb'}].to_set, + @json[:tech_contacts].to_set) + end + def test_returns_nameserver_hostnames_or_an_empty_array expected_nameserver_1 = { hostname: 'ns1.bestnames.test', @@ -53,8 +67,8 @@ class SerializersRegistrantApiDomainTest < ApplicationIntegrationTest def test_other_fields_are_also_present keys = %i[id name registrar registered_at valid_to created_at updated_at - registrant transfer_code name_dirty name_puny period period_unit - creator_str updator_str legacy_id legacy_registrar_id legacy_registrant_id + registrant tech_contacts admin_contacts transfer_code name_dirty name_puny period + period_unit creator_str updator_str legacy_id legacy_registrar_id legacy_registrant_id outzone_at delete_at registrant_verification_asked_at registrant_verification_token pending_json force_delete_at statuses locked_by_registrant_at reserved status_notes nameservers]