mirror of
https://github.com/internetee/registry.git
synced 2025-06-11 23:24:48 +02:00
parent
bb108efedd
commit
fa52001be6
141 changed files with 1388 additions and 1664 deletions
|
@ -12,7 +12,7 @@ class RegistrantApiDomainsTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_get_domain_details_by_uuid
|
||||
get '/api/v1/registrant/domains/5edda1a5-3548-41ee-8b65-6d60daf85a37', {}, @auth_headers
|
||||
get '/api/v1/registrant/domains/5edda1a5-3548-41ee-8b65-6d60daf85a37', headers: @auth_headers
|
||||
assert_equal(200, response.status)
|
||||
|
||||
domain = JSON.parse(response.body, symbolize_names: true)
|
||||
|
@ -30,7 +30,7 @@ class RegistrantApiDomainsTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_get_non_existent_domain_details_by_uuid
|
||||
get '/api/v1/registrant/domains/random-uuid', {}, @auth_headers
|
||||
get '/api/v1/registrant/domains/random-uuid', headers: @auth_headers
|
||||
assert_equal(404, response.status)
|
||||
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
@ -38,7 +38,7 @@ class RegistrantApiDomainsTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_root_returns_domain_list
|
||||
get '/api/v1/registrant/domains', {}, @auth_headers
|
||||
get '/api/v1/registrant/domains', headers: @auth_headers
|
||||
assert_equal(200, response.status)
|
||||
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
@ -50,20 +50,22 @@ class RegistrantApiDomainsTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_root_accepts_limit_and_offset_parameters
|
||||
get '/api/v1/registrant/domains', { 'limit' => 2, 'offset' => 0 }, @auth_headers
|
||||
get '/api/v1/registrant/domains', params: { 'limit' => 2, 'offset' => 0 },
|
||||
headers: @auth_headers
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
||||
assert_equal(200, response.status)
|
||||
assert_equal(2, response_json.count)
|
||||
|
||||
get '/api/v1/registrant/domains', {}, @auth_headers
|
||||
get '/api/v1/registrant/domains', headers: @auth_headers
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
||||
assert_equal(4, response_json.count)
|
||||
end
|
||||
|
||||
def test_root_does_not_accept_limit_higher_than_200
|
||||
get '/api/v1/registrant/domains', { 'limit' => 400, 'offset' => 0 }, @auth_headers
|
||||
get '/api/v1/registrant/domains', params: { 'limit' => 400, 'offset' => 0 },
|
||||
headers: @auth_headers
|
||||
|
||||
assert_equal(400, response.status)
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
@ -71,7 +73,8 @@ class RegistrantApiDomainsTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_root_does_not_accept_offset_lower_than_0
|
||||
get '/api/v1/registrant/domains', { 'limit' => 200, 'offset' => "-10" }, @auth_headers
|
||||
get '/api/v1/registrant/domains', params: { 'limit' => 200, 'offset' => "-10" },
|
||||
headers: @auth_headers
|
||||
|
||||
assert_equal(400, response.status)
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
@ -79,7 +82,7 @@ class RegistrantApiDomainsTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_root_returns_401_without_authorization
|
||||
get '/api/v1/registrant/domains', {}, {}
|
||||
get '/api/v1/registrant/domains'
|
||||
assert_equal(401, response.status)
|
||||
json_body = JSON.parse(response.body, symbolize_names: true)
|
||||
|
||||
|
@ -87,7 +90,7 @@ class RegistrantApiDomainsTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_details_returns_401_without_authorization
|
||||
get '/api/v1/registrant/domains/5edda1a5-3548-41ee-8b65-6d60daf85a37', {}, {}
|
||||
get '/api/v1/registrant/domains/5edda1a5-3548-41ee-8b65-6d60daf85a37'
|
||||
assert_equal(401, response.status)
|
||||
json_body = JSON.parse(response.body, symbolize_names: true)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue