Reflect new behaviour of registrant API in tests

This commit is contained in:
Karl Erik Õunapuu 2020-12-04 15:24:14 +02:00
parent 15d2ffe200
commit 92b294e81b
No known key found for this signature in database
GPG key ID: C9DD647298A34764
2 changed files with 5 additions and 5 deletions

View file

@ -50,10 +50,10 @@ class RegistrantApiDomainsTest < ApplicationIntegrationTest
assert_equal(200, response.status)
response_json = JSON.parse(response.body, symbolize_names: true)
array_of_domain_names = response_json.map { |x| x[:name] }
array_of_domain_names = response_json[:domains].map { |x| x[:name] }
assert(array_of_domain_names.include?('hospital.test'))
array_of_domain_registrars = response_json.map { |x| x[:registrar] }
array_of_domain_registrars = response_json[:domains].map { |x| x[:registrar] }
assert(array_of_domain_registrars.include?({name: 'Good Names', website: nil}))
end
@ -63,12 +63,12 @@ class RegistrantApiDomainsTest < ApplicationIntegrationTest
response_json = JSON.parse(response.body, symbolize_names: true)
assert_equal(200, response.status)
assert_equal(2, response_json.count)
assert_equal(2, response_json[:domains].count)
get '/api/v1/registrant/domains', headers: @auth_headers
response_json = JSON.parse(response.body, symbolize_names: true)
assert_equal(4, response_json.count)
assert_equal(4, response_json[:domains].count)
end
def test_root_does_not_accept_limit_higher_than_200

View file

@ -4,7 +4,7 @@ require 'serializers/registrant_api/contact'
class SerializersRegistrantApiContactTest < ActiveSupport::TestCase
def setup
@contact = contacts(:william)
@serializer = Serializers::RegistrantApi::Contact.new(@contact)
@serializer = Serializers::RegistrantApi::Contact.new(@contact, false)
@json = @serializer.to_json
end