From 1d1c336117cd5f3f16f959ed5af70d0076c97ec0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Thu, 21 Jan 2021 13:18:47 +0200 Subject: [PATCH] Registrant API: Verify new contact link(s) structure --- .../api/registrant/registrant_api_contacts_test.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/integration/api/registrant/registrant_api_contacts_test.rb b/test/integration/api/registrant/registrant_api_contacts_test.rb index 191222764..f3998a2e9 100644 --- a/test/integration/api/registrant/registrant_api_contacts_test.rb +++ b/test/integration/api/registrant/registrant_api_contacts_test.rb @@ -57,6 +57,15 @@ class RegistrantApiContactsTest < ApplicationIntegrationTest assert_equal({ errors: [base: ['Not authorized']] }, json_body) end + def test_gets_contact_domain_links_when_requested + get "/api/v1/registrant/contacts/#{@contact.uuid}?links=true", headers: @auth_headers + + expected_links = @contact.domains.uniq.map { |d| { name: d.name, id: d.uuid }} + assert_response :ok + response_json = JSON.parse(response.body, symbolize_names: true) + + assert_empty expected_links - response_json[:links] + end private def auth_token