Merge pull request #1750 from internetee/registrant-api-fetch-improvements

Registrant API: Include total domain count
This commit is contained in:
Timo Võhmar 2020-12-15 11:28:45 +02:00 committed by GitHub
commit 0d09327493
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 51 additions and 26 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