mirror of
https://github.com/internetee/registry.git
synced 2025-07-23 19:20:37 +02:00
Merge remote-tracking branch 'origin/master' into 269-dispute-list
This commit is contained in:
commit
7ef15a5bf1
15 changed files with 448 additions and 36 deletions
19
test/integration/registrant_area/contacts_test.rb
Normal file
19
test/integration/registrant_area/contacts_test.rb
Normal file
|
@ -0,0 +1,19 @@
|
|||
require 'test_helper'
|
||||
|
||||
class RegistrantAreaContactsIntegrationTest < ApplicationIntegrationTest
|
||||
setup do
|
||||
@domain = domains(:shop)
|
||||
@registrant = users(:registrant)
|
||||
sign_in @registrant
|
||||
end
|
||||
|
||||
def test_can_view_other_domain_contacts
|
||||
secondary_contact = contacts(:jane)
|
||||
|
||||
visit registrant_domain_path(@domain)
|
||||
assert_text secondary_contact.name
|
||||
click_link secondary_contact.name
|
||||
assert_text @domain.name
|
||||
assert_text secondary_contact.email
|
||||
end
|
||||
end
|
23
test/integration/repp/auctions_test.rb
Normal file
23
test/integration/repp/auctions_test.rb
Normal file
|
@ -0,0 +1,23 @@
|
|||
require 'test_helper'
|
||||
|
||||
class ReppV1AuctionsTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
@auction = auctions(:one)
|
||||
|
||||
@auction.update!(uuid: '1b3ee442-e8fe-4922-9492-8fcb9dccc69c',
|
||||
domain: 'auction.test',
|
||||
status: Auction.statuses[:started])
|
||||
end
|
||||
|
||||
def test_get_index
|
||||
get repp_v1_auctions_path
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
||||
assert response_json[:count] == 1
|
||||
|
||||
expected_response = [{ domain_name: @auction.domain,
|
||||
punycode_domain_name: @auction.domain }]
|
||||
|
||||
assert_equal expected_response, response_json[:auctions]
|
||||
end
|
||||
end
|
74
test/integration/repp/retained_domains_test.rb
Normal file
74
test/integration/repp/retained_domains_test.rb
Normal file
|
@ -0,0 +1,74 @@
|
|||
require 'test_helper'
|
||||
|
||||
class ReppV1RetainedDomainsTest < ActionDispatch::IntegrationTest
|
||||
# Uses magical fixtures, will fail once fixtures inside are changed:
|
||||
# test/fixtures/blocked_domains.yml
|
||||
# test/fixtures/reserved_domains.yml
|
||||
|
||||
def test_get_index
|
||||
get repp_v1_retained_domains_path
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
||||
assert response_json[:count] == 3
|
||||
|
||||
expected_objects = [{ name: 'blocked.test',
|
||||
status: 'blocked',
|
||||
punycode_name: 'blocked.test' },
|
||||
{ name: 'blockedäöüõ.test',
|
||||
status: 'blocked',
|
||||
punycode_name: 'xn--blocked-cxa7mj0e.test' },
|
||||
{ name: 'reserved.test',
|
||||
status: 'reserved',
|
||||
punycode_name: 'reserved.test' }]
|
||||
|
||||
assert_equal response_json[:domains], expected_objects
|
||||
end
|
||||
|
||||
def test_get_index_with_type_parameter
|
||||
get repp_v1_retained_domains_path({ 'type' => 'reserved' })
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
||||
assert response_json[:count] == 1
|
||||
|
||||
expected_objects = [{ name: 'reserved.test',
|
||||
status: 'reserved',
|
||||
punycode_name: 'reserved.test' }]
|
||||
|
||||
assert_equal response_json[:domains], expected_objects
|
||||
end
|
||||
|
||||
def test_etags_cache
|
||||
get repp_v1_retained_domains_path({ 'type' => 'reserved' })
|
||||
etag = response.headers['ETag']
|
||||
|
||||
get repp_v1_retained_domains_path({ 'type' => 'reserved' }),
|
||||
headers: { 'If-None-Match' => etag }
|
||||
|
||||
assert_equal response.status, 304
|
||||
assert_equal response.body, ''
|
||||
end
|
||||
|
||||
def test_etags_cache_valid_for_type_only
|
||||
get repp_v1_retained_domains_path({ 'type' => 'blocked' })
|
||||
etag = response.headers['ETag']
|
||||
|
||||
get repp_v1_retained_domains_path, headers: { 'If-None-Match' => etag }
|
||||
|
||||
assert_equal response.status, 200
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
assert response_json[:count] == 3
|
||||
end
|
||||
|
||||
def test_cors_preflight
|
||||
process :options, repp_v1_retained_domains_path, headers: { 'Origin' => 'https://example.com' }
|
||||
|
||||
assert_equal('https://example.com', response.headers['Access-Control-Allow-Origin'])
|
||||
assert_equal('POST, GET, PUT, PATCH, DELETE, OPTIONS',
|
||||
response.headers['Access-Control-Allow-Methods'])
|
||||
assert_equal('Origin, Content-Type, Accept, Authorization, Token, Auth-Token, Email, ' \
|
||||
'X-User-Token, X-User-Email',
|
||||
response.headers['Access-Control-Allow-Headers'])
|
||||
assert_equal('3600', response.headers['Access-Control-Max-Age'])
|
||||
assert_equal('', response.body)
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue