mirror of
https://github.com/internetee/registry.git
synced 2025-07-25 12:08:27 +02:00
parent
bb108efedd
commit
fa52001be6
141 changed files with 1388 additions and 1664 deletions
|
@ -12,7 +12,7 @@ class AdminAreaRegistrarsIntegrationTest < ActionDispatch::IntegrationTest
|
|||
new_iban = 'GB94BARC10201530093459'
|
||||
assert_not_equal new_iban, @registrar.iban
|
||||
|
||||
patch admin_registrar_path(@registrar), registrar: { iban: new_iban }
|
||||
patch admin_registrar_path(@registrar), params: { registrar: { iban: new_iban } }
|
||||
@registrar.reload
|
||||
|
||||
assert_equal new_iban, @registrar.iban
|
||||
|
|
|
@ -10,7 +10,7 @@ class AdminAreaZonesIntegrationTest < ApplicationIntegrationTest
|
|||
new_master_nameserver = 'new.test'
|
||||
assert_not_equal new_master_nameserver, @zone.master_nameserver
|
||||
|
||||
patch admin_zone_path(@zone), zone: { master_nameserver: new_master_nameserver }
|
||||
patch admin_zone_path(@zone), params: { zone: { master_nameserver: new_master_nameserver } }
|
||||
@zone.reload
|
||||
|
||||
assert_equal new_master_nameserver, @zone.master_nameserver
|
||||
|
|
|
@ -2,9 +2,9 @@ require 'test_helper'
|
|||
|
||||
class APIDomainContactsTest < ApplicationIntegrationTest
|
||||
def test_replace_all_tech_contacts_of_the_current_registrar
|
||||
patch '/repp/v1/domains/contacts', { current_contact_id: 'william-001',
|
||||
new_contact_id: 'john-001' },
|
||||
{ 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
patch '/repp/v1/domains/contacts', params: { current_contact_id: 'william-001',
|
||||
new_contact_id: 'john-001' },
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
|
||||
assert_nil domains(:shop).tech_contacts.find_by(code: 'william-001')
|
||||
assert domains(:shop).tech_contacts.find_by(code: 'john-001')
|
||||
|
@ -14,17 +14,17 @@ class APIDomainContactsTest < ApplicationIntegrationTest
|
|||
def test_skip_discarded_domains
|
||||
domains(:airport).update!(statuses: [DomainStatus::DELETE_CANDIDATE])
|
||||
|
||||
patch '/repp/v1/domains/contacts', { current_contact_id: 'william-001',
|
||||
new_contact_id: 'john-001' },
|
||||
{ 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
patch '/repp/v1/domains/contacts', params: { current_contact_id: 'william-001',
|
||||
new_contact_id: 'john-001' },
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
|
||||
assert domains(:airport).tech_contacts.find_by(code: 'william-001')
|
||||
end
|
||||
|
||||
def test_return_affected_domains_in_alphabetical_order
|
||||
patch '/repp/v1/domains/contacts', { current_contact_id: 'william-001',
|
||||
new_contact_id: 'john-001' },
|
||||
{ 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
patch '/repp/v1/domains/contacts', params: { current_contact_id: 'william-001',
|
||||
new_contact_id: 'john-001' },
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
|
||||
assert_response :ok
|
||||
assert_equal ({ affected_domains: %w[airport.test shop.test],
|
||||
|
@ -36,9 +36,9 @@ class APIDomainContactsTest < ApplicationIntegrationTest
|
|||
domains(:shop).update!(statuses: [DomainStatus::DELETE_CANDIDATE])
|
||||
domains(:airport).update!(statuses: [DomainStatus::DELETE_CANDIDATE])
|
||||
|
||||
patch '/repp/v1/domains/contacts', { current_contact_id: 'william-001',
|
||||
new_contact_id: 'john-001' },
|
||||
{ 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
patch '/repp/v1/domains/contacts', params: { current_contact_id: 'william-001',
|
||||
new_contact_id: 'john-001' },
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
|
||||
assert_response :ok
|
||||
assert_equal %w[airport.test shop.test], JSON.parse(response.body,
|
||||
|
@ -46,25 +46,25 @@ class APIDomainContactsTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_keep_other_tech_contacts_intact
|
||||
patch '/repp/v1/domains/contacts', { current_contact_id: 'william-001',
|
||||
new_contact_id: 'john-001' },
|
||||
{ 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
patch '/repp/v1/domains/contacts', params: { current_contact_id: 'william-001',
|
||||
new_contact_id: 'john-001' },
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
|
||||
assert domains(:shop).tech_contacts.find_by(code: 'acme-ltd-001')
|
||||
end
|
||||
|
||||
def test_keep_admin_contacts_intact
|
||||
patch '/repp/v1/domains/contacts', { current_contact_id: 'william-001',
|
||||
new_contact_id: 'john-001' },
|
||||
{ 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
patch '/repp/v1/domains/contacts', params: { current_contact_id: 'william-001',
|
||||
new_contact_id: 'john-001' },
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
|
||||
assert domains(:airport).admin_contacts.find_by(code: 'william-001')
|
||||
end
|
||||
|
||||
def test_restrict_contacts_to_the_current_registrar
|
||||
patch '/repp/v1/domains/contacts', { current_contact_id: 'jack-001',
|
||||
new_contact_id: 'william-002' },
|
||||
{ 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
patch '/repp/v1/domains/contacts', params: { current_contact_id: 'jack-001',
|
||||
new_contact_id: 'william-002' },
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
|
||||
assert_response :bad_request
|
||||
assert_equal ({ error: { type: 'invalid_request_error',
|
||||
|
@ -74,9 +74,9 @@ class APIDomainContactsTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_non_existent_current_contact
|
||||
patch '/repp/v1/domains/contacts', { current_contact_id: 'non-existent',
|
||||
new_contact_id: 'john-001' },
|
||||
{ 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
patch '/repp/v1/domains/contacts', params: { current_contact_id: 'non-existent',
|
||||
new_contact_id: 'john-001' },
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
assert_response :bad_request
|
||||
assert_equal ({ error: { type: 'invalid_request_error',
|
||||
param: 'current_contact_id',
|
||||
|
@ -85,9 +85,9 @@ class APIDomainContactsTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_non_existent_new_contact
|
||||
patch '/repp/v1/domains/contacts', { current_contact_id: 'william-001',
|
||||
new_contact_id: 'non-existent' },
|
||||
{ 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
patch '/repp/v1/domains/contacts', params: { current_contact_id: 'william-001',
|
||||
new_contact_id: 'non-existent' },
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
assert_response :bad_request
|
||||
assert_equal ({ error: { type: 'invalid_request_error',
|
||||
param: 'new_contact_id',
|
||||
|
@ -96,9 +96,9 @@ class APIDomainContactsTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_disallow_invalid_new_contact
|
||||
patch '/repp/v1/domains/contacts', { current_contact_id: 'william-001',
|
||||
new_contact_id: 'invalid' },
|
||||
{ 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
patch '/repp/v1/domains/contacts', params: { current_contact_id: 'william-001',
|
||||
new_contact_id: 'invalid' },
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
assert_response :bad_request
|
||||
assert_equal ({ error: { type: 'invalid_request_error',
|
||||
param: 'new_contact_id',
|
||||
|
@ -107,9 +107,9 @@ class APIDomainContactsTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_disallow_self_replacement
|
||||
patch '/repp/v1/domains/contacts', { current_contact_id: 'william-001',
|
||||
new_contact_id: 'william-001' },
|
||||
{ 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
patch '/repp/v1/domains/contacts', params: { current_contact_id: 'william-001',
|
||||
new_contact_id: 'william-001' },
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
assert_response :bad_request
|
||||
assert_equal ({ error: { type: 'invalid_request_error',
|
||||
message: 'New contact ID must be different from current contact ID' } }),
|
||||
|
|
|
@ -13,7 +13,8 @@ class APIDomainTransfersTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_returns_domain_transfers
|
||||
post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
post '/repp/v1/domain_transfers', params: request_params, as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
assert_response 200
|
||||
assert_equal ({ data: [{
|
||||
type: 'domain_transfer',
|
||||
|
@ -26,17 +27,20 @@ class APIDomainTransfersTest < ApplicationIntegrationTest
|
|||
|
||||
def test_creates_new_domain_transfer
|
||||
assert_difference -> { @domain.transfers.size } do
|
||||
post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
post '/repp/v1/domain_transfers', params: request_params, as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
end
|
||||
end
|
||||
|
||||
def test_approves_automatically_if_auto_approval_is_enabled
|
||||
post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
post '/repp/v1/domain_transfers', params: request_params, as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
assert @domain.transfers.last.approved?
|
||||
end
|
||||
|
||||
def test_assigns_new_registrar
|
||||
post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
post '/repp/v1/domain_transfers', params: request_params, as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
@domain.reload
|
||||
assert_equal @new_registrar, @domain.registrar
|
||||
end
|
||||
|
@ -44,7 +48,8 @@ class APIDomainTransfersTest < ApplicationIntegrationTest
|
|||
def test_regenerates_transfer_code
|
||||
@old_transfer_code = @domain.transfer_code
|
||||
|
||||
post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
post '/repp/v1/domain_transfers', params: request_params, as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
@domain.reload
|
||||
refute_equal @domain.transfer_code, @old_transfer_code
|
||||
end
|
||||
|
@ -53,34 +58,41 @@ class APIDomainTransfersTest < ApplicationIntegrationTest
|
|||
@old_registrar = @domain.registrar
|
||||
|
||||
assert_difference -> { @old_registrar.notifications.count } do
|
||||
post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
post '/repp/v1/domain_transfers', params: request_params, as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
end
|
||||
end
|
||||
|
||||
def test_duplicates_registrant_admin_and_tech_contacts
|
||||
assert_difference -> { @new_registrar.contacts.size }, 3 do
|
||||
post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
post '/repp/v1/domain_transfers', params: request_params, as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
end
|
||||
end
|
||||
|
||||
def test_reuses_identical_contact
|
||||
post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
post '/repp/v1/domain_transfers', params: request_params, as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
assert_equal 1, @new_registrar.contacts.where(name: 'William').size
|
||||
end
|
||||
|
||||
def test_fails_if_domain_does_not_exist
|
||||
request_params = { format: :json,
|
||||
data: { domainTransfers: [{ domainName: 'non-existent.test', transferCode: 'any' }] } }
|
||||
post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
post '/repp/v1/domain_transfers',
|
||||
params: { data: { domainTransfers: [{ domainName: 'non-existent.test',
|
||||
transferCode: 'any' }] } },
|
||||
as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
assert_response 400
|
||||
assert_equal ({ errors: [{ title: 'non-existent.test does not exist' }] }),
|
||||
JSON.parse(response.body, symbolize_names: true)
|
||||
end
|
||||
|
||||
def test_fails_if_transfer_code_is_wrong
|
||||
request_params = { format: :json,
|
||||
data: { domainTransfers: [{ domainName: 'shop.test', transferCode: 'wrong' }] } }
|
||||
post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
post '/repp/v1/domain_transfers',
|
||||
params: { data: { domainTransfers: [{ domainName: 'shop.test',
|
||||
transferCode: 'wrong' }] } },
|
||||
as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
assert_response 400
|
||||
refute_equal @new_registrar, @domain.registrar
|
||||
assert_equal ({ errors: [{ title: 'shop.test transfer code is wrong' }] }),
|
||||
|
@ -90,8 +102,7 @@ class APIDomainTransfersTest < ApplicationIntegrationTest
|
|||
private
|
||||
|
||||
def request_params
|
||||
{ format: :json,
|
||||
data: { domainTransfers: [{ domainName: 'shop.test', transferCode: '65078d5' }] } }
|
||||
{ data: { domainTransfers: [{ domainName: 'shop.test', transferCode: '65078d5' }] } }
|
||||
end
|
||||
|
||||
def http_auth_key
|
||||
|
|
|
@ -5,18 +5,23 @@ class APINameserversPutTest < ApplicationIntegrationTest
|
|||
old_nameserver_ids = [nameservers(:shop_ns1).id,
|
||||
nameservers(:airport_ns1).id,
|
||||
nameservers(:metro_ns1).id]
|
||||
request_params = { format: :json, data: { type: 'nameserver', id: 'ns1.bestnames.test',
|
||||
attributes: { hostname: 'ns55.bestnames.test' } } }
|
||||
put '/repp/v1/registrar/nameservers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
assert_empty (old_nameserver_ids & registrars(:bestnames).nameservers(true).ids)
|
||||
params = { data: { type: 'nameserver',
|
||||
id: 'ns1.bestnames.test',
|
||||
attributes: { hostname: 'ns55.bestnames.test' } } }
|
||||
|
||||
put '/repp/v1/registrar/nameservers', params: params, as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
|
||||
assert_empty (old_nameserver_ids & registrars(:bestnames).nameservers.reload.ids)
|
||||
end
|
||||
|
||||
def test_saves_all_attributes
|
||||
request_params = { format: :json, data: { type: 'nameserver', id: 'ns1.bestnames.test',
|
||||
attributes: { hostname: 'ns55.bestnames.test',
|
||||
ipv4: ['192.0.2.55'],
|
||||
ipv6: ['2001:db8::55'] } } }
|
||||
put '/repp/v1/registrar/nameservers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
params = { data: { type: 'nameserver', id: 'ns1.bestnames.test',
|
||||
attributes: { hostname: 'ns55.bestnames.test',
|
||||
ipv4: ['192.0.2.55'],
|
||||
ipv6: ['2001:db8::55'] } } }
|
||||
put '/repp/v1/registrar/nameservers', params: params, as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
|
||||
new_nameserver = domains(:shop).nameservers.find_by(hostname: 'ns55.bestnames.test')
|
||||
assert_equal ['192.0.2.55'], new_nameserver.ipv4
|
||||
|
@ -24,52 +29,60 @@ class APINameserversPutTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_keeps_other_nameserver_intact
|
||||
request_params = { format: :json, data: { type: 'nameserver', id: 'ns1.bestnames.test',
|
||||
attributes: { hostname: 'ns55.bestnames.test' } } }
|
||||
params = { data: { type: 'nameserver', id: 'ns1.bestnames.test',
|
||||
attributes: { hostname: 'ns55.bestnames.test' } } }
|
||||
|
||||
other_nameserver_hash = nameservers(:shop_ns2).attributes
|
||||
put '/repp/v1/registrar/nameservers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
put '/repp/v1/registrar/nameservers', params: params, as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
|
||||
assert_equal other_nameserver_hash, nameservers(:shop_ns2).reload.attributes
|
||||
end
|
||||
|
||||
def test_keeps_other_registrar_nameservers_intact
|
||||
request_params = { format: :json, data: { type: 'nameserver', id: 'ns1.bestnames.test',
|
||||
attributes: { hostname: 'ns55.bestnames.test' } } }
|
||||
params = { data: { type: 'nameserver', id: 'ns1.bestnames.test',
|
||||
attributes: { hostname: 'ns55.bestnames.test' } } }
|
||||
|
||||
nameserver_hash = nameservers(:metro_ns1).attributes
|
||||
put '/repp/v1/registrar/nameservers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
put '/repp/v1/registrar/nameservers', params: params, as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
|
||||
assert_equal nameserver_hash, nameservers(:metro_ns1).reload.attributes
|
||||
end
|
||||
|
||||
def test_returns_new_nameserver_record_and_affected_domain
|
||||
request_params = { format: :json, data: { type: 'nameserver', id: 'ns1.bestnames.test',
|
||||
attributes: { hostname: 'ns55.bestnames.test',
|
||||
ipv4: ['192.0.2.55'],
|
||||
ipv6: ['2001:db8::55'] } } }
|
||||
params = { data: { type: 'nameserver', id: 'ns1.bestnames.test',
|
||||
attributes: { hostname: 'ns55.bestnames.test',
|
||||
ipv4: ['192.0.2.55'],
|
||||
ipv6: ['2001:db8::55'] } } }
|
||||
|
||||
put '/repp/v1/registrar/nameservers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
put '/repp/v1/registrar/nameservers', params: params, as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
|
||||
assert_response 200
|
||||
assert_equal ({ data: { type: 'nameserver',
|
||||
id: 'ns55.bestnames.test',
|
||||
attributes: { hostname: 'ns55.bestnames.test',
|
||||
ipv4: ['192.0.2.55'],
|
||||
ipv6: ['2001:db8::55'] }},
|
||||
ipv6: ['2001:db8::55'] } },
|
||||
affected_domains: ["airport.test", "shop.test"] }),
|
||||
JSON.parse(response.body, symbolize_names: true)
|
||||
end
|
||||
|
||||
def test_optional_params
|
||||
request_params = { format: :json, data: { type: 'nameserver', id: 'ns1.bestnames.test',
|
||||
attributes: { hostname: 'ns55.bestnames.test' } } }
|
||||
put '/repp/v1/registrar/nameservers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
params = { data: { type: 'nameserver', id: 'ns1.bestnames.test',
|
||||
attributes: { hostname: 'ns55.bestnames.test' } } }
|
||||
put '/repp/v1/registrar/nameservers', params: params, as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
|
||||
assert_response 200
|
||||
end
|
||||
|
||||
def test_non_existent_nameserver_hostname
|
||||
request_params = { format: :json, data: { type: 'nameserver', id: 'non-existent.test',
|
||||
attributes: { hostname: 'any.bestnames.test' } } }
|
||||
put '/repp/v1/registrar/nameservers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
params = { data: { type: 'nameserver', id: 'non-existent.test',
|
||||
attributes: { hostname: 'any.bestnames.test' } } }
|
||||
put '/repp/v1/registrar/nameservers', params: params, as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
|
||||
assert_response 404
|
||||
assert_equal ({ errors: [{ title: 'Hostname non-existent.test does not exist' }] }),
|
||||
|
@ -77,9 +90,10 @@ class APINameserversPutTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_invalid_request_params
|
||||
request_params = { format: :json, data: { type: 'nameserver', id: 'ns1.bestnames.test',
|
||||
attributes: { hostname: '' } } }
|
||||
put '/repp/v1/registrar/nameservers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
params = { data: { type: 'nameserver', id: 'ns1.bestnames.test',
|
||||
attributes: { hostname: '' } } }
|
||||
put '/repp/v1/registrar/nameservers', params: params, as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||
|
||||
assert_response 400
|
||||
assert_equal ({ errors: [{ title: 'Hostname is missing' }] }),
|
||||
|
|
|
@ -20,7 +20,7 @@ class RegistrantApiAuthenticationTest < ApplicationIntegrationTest
|
|||
last_name: 'Smith',
|
||||
}
|
||||
|
||||
post '/api/v1/registrant/auth/eid', params
|
||||
post '/api/v1/registrant/auth/eid', params: params
|
||||
assert(User.find_by(registrant_ident: 'EE-30110100103'))
|
||||
|
||||
json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
@ -29,7 +29,7 @@ class RegistrantApiAuthenticationTest < ApplicationIntegrationTest
|
|||
|
||||
def test_request_returns_existing_user
|
||||
assert_no_changes User.count do
|
||||
post '/api/v1/registrant/auth/eid', @user_hash
|
||||
post '/api/v1/registrant/auth/eid', params: @user_hash
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -38,7 +38,7 @@ class RegistrantApiAuthenticationTest < ApplicationIntegrationTest
|
|||
@original_whitelist_ip = ENV['registrant_api_auth_allowed_ips']
|
||||
ENV['registrant_api_auth_allowed_ips'] = '1.2.3.4'
|
||||
|
||||
post '/api/v1/registrant/auth/eid', params
|
||||
post '/api/v1/registrant/auth/eid', params: params
|
||||
assert_equal(401, response.status)
|
||||
json_body = JSON.parse(response.body, symbolize_names: true)
|
||||
|
||||
|
@ -50,7 +50,7 @@ class RegistrantApiAuthenticationTest < ApplicationIntegrationTest
|
|||
def test_request_documented_parameters_are_required
|
||||
params = { foo: :bar, test: :test }
|
||||
|
||||
post '/api/v1/registrant/auth/eid', params
|
||||
post '/api/v1/registrant/auth/eid', params: params
|
||||
json = JSON.parse(response.body, symbolize_names: true)
|
||||
assert_equal({ errors: [{ ident: ['parameter is required'] }] }, json)
|
||||
assert_equal(422, response.status)
|
||||
|
|
|
@ -14,18 +14,19 @@ class RegistrantApiContactsTest < ApplicationIntegrationTest
|
|||
contacts(:william).update!(ident: '1234', ident_type: 'priv', ident_country_code: 'US')
|
||||
assert_equal 3, @user.contacts.size
|
||||
|
||||
get '/api/v1/registrant/contacts', { 'limit' => 1, 'offset' => 0 }, @auth_headers
|
||||
get '/api/v1/registrant/contacts', params: { 'limit' => 1, 'offset' => 0 },
|
||||
headers: @auth_headers
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
assert_equal(200, response.status)
|
||||
assert_equal(1, response_json.count)
|
||||
|
||||
get '/api/v1/registrant/contacts', {}, @auth_headers
|
||||
get '/api/v1/registrant/contacts', headers: @auth_headers
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
assert_equal(3, response_json.count)
|
||||
end
|
||||
|
||||
def test_get_contact_details_by_uuid
|
||||
get api_v1_registrant_contact_path(@contact.uuid), nil, @auth_headers
|
||||
get api_v1_registrant_contact_path(@contact.uuid), headers: @auth_headers
|
||||
|
||||
assert_response :ok
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
@ -33,21 +34,23 @@ class RegistrantApiContactsTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_root_does_not_accept_limit_higher_than_200
|
||||
get '/api/v1/registrant/contacts', { 'limit' => 400, 'offset' => 0 }, @auth_headers
|
||||
get '/api/v1/registrant/contacts', params: { 'limit' => 400, 'offset' => 0 },
|
||||
headers: @auth_headers
|
||||
assert_equal(400, response.status)
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
assert_equal({ errors: [{ limit: ['parameter is out of range'] }] }, response_json)
|
||||
end
|
||||
|
||||
def test_root_does_not_accept_offset_lower_than_0
|
||||
get '/api/v1/registrant/contacts', { 'limit' => 200, 'offset' => "-10" }, @auth_headers
|
||||
get '/api/v1/registrant/contacts', params: { 'limit' => 200, 'offset' => "-10" },
|
||||
headers: @auth_headers
|
||||
assert_equal(400, response.status)
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
assert_equal({ errors: [{ offset: ['parameter is out of range'] }] }, response_json)
|
||||
end
|
||||
|
||||
def test_root_returns_401_without_authorization
|
||||
get '/api/v1/registrant/contacts', {}, {}
|
||||
get '/api/v1/registrant/contacts'
|
||||
assert_equal(401, response.status)
|
||||
json_body = JSON.parse(response.body, symbolize_names: true)
|
||||
|
||||
|
|
|
@ -2,13 +2,13 @@ require 'test_helper'
|
|||
|
||||
class RegistrantApiCorsHeadersTest < ApplicationIntegrationTest
|
||||
def test_returns_200_response_code_for_options_request
|
||||
options '/api/v1/registrant/auth/eid', {}, { 'Origin' => 'https://example.com' }
|
||||
|
||||
process :options, api_v1_registrant_auth_eid_path,
|
||||
headers: { 'Origin' => 'https://example.com' }
|
||||
assert_equal('200', response.code)
|
||||
end
|
||||
|
||||
def test_returns_expected_headers_for_options_requests
|
||||
options '/api/v1/registrant/auth/eid', {}, { 'Origin' => 'https://example.com' }
|
||||
process :options, api_v1_registrant_auth_eid_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',
|
||||
|
@ -20,16 +20,15 @@ class RegistrantApiCorsHeadersTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_returns_empty_body
|
||||
options '/api/v1/registrant/auth/eid', { 'Origin' => 'https://example.com' }
|
||||
|
||||
process :options, api_v1_registrant_auth_eid_path, headers: { 'Origin' => 'https://example.com' }
|
||||
assert_equal('', response.body)
|
||||
end
|
||||
|
||||
def test_it_returns_cors_headers_for_other_requests
|
||||
post '/api/v1/registrant/auth/eid', {}, { 'Origin' => 'https://example.com' }
|
||||
post '/api/v1/registrant/auth/eid', headers: { 'Origin' => 'https://example.com' }
|
||||
assert_equal('https://example.com', response.headers['Access-Control-Allow-Origin'])
|
||||
|
||||
get '/api/v1/registrant/contacts', {}, { 'Origin' => 'https://example.com' }
|
||||
get '/api/v1/registrant/contacts', headers: { 'Origin' => 'https://example.com' }
|
||||
assert_equal('https://example.com', response.headers['Access-Control-Allow-Origin'])
|
||||
end
|
||||
end
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ class RegistrantApiRegistryLocksTest < ApplicationIntegrationTest
|
|||
|
||||
def test_can_lock_a_not_locked_domain
|
||||
post '/api/v1/registrant/domains/2df2c1a1-8f6a-490a-81be-8bdf29866880/registry_lock',
|
||||
{}, @auth_headers
|
||||
headers: @auth_headers
|
||||
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
||||
|
@ -27,7 +27,7 @@ class RegistrantApiRegistryLocksTest < ApplicationIntegrationTest
|
|||
def test_locking_a_domain_creates_a_version_record
|
||||
assert_difference '@domain.versions.count', 1 do
|
||||
post '/api/v1/registrant/domains/2df2c1a1-8f6a-490a-81be-8bdf29866880/registry_lock',
|
||||
{}, @auth_headers
|
||||
headers: @auth_headers
|
||||
end
|
||||
|
||||
@domain.reload
|
||||
|
@ -39,7 +39,7 @@ class RegistrantApiRegistryLocksTest < ApplicationIntegrationTest
|
|||
@domain.save
|
||||
|
||||
post '/api/v1/registrant/domains/2df2c1a1-8f6a-490a-81be-8bdf29866880/registry_lock',
|
||||
{}, @auth_headers
|
||||
headers: @auth_headers
|
||||
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
assert_equal(422, response.status)
|
||||
|
@ -51,7 +51,7 @@ class RegistrantApiRegistryLocksTest < ApplicationIntegrationTest
|
|||
assert(@domain.locked_by_registrant?)
|
||||
|
||||
post '/api/v1/registrant/domains/2df2c1a1-8f6a-490a-81be-8bdf29866880/registry_lock',
|
||||
{}, @auth_headers
|
||||
headers: @auth_headers
|
||||
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
assert_equal(422, response.status)
|
||||
|
@ -62,7 +62,7 @@ class RegistrantApiRegistryLocksTest < ApplicationIntegrationTest
|
|||
@domain.apply_registry_lock
|
||||
|
||||
delete '/api/v1/registrant/domains/2df2c1a1-8f6a-490a-81be-8bdf29866880/registry_lock',
|
||||
{}, @auth_headers
|
||||
headers: @auth_headers
|
||||
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
assert(response_json[:statuses].include?(DomainStatus::OK))
|
||||
|
@ -73,7 +73,7 @@ class RegistrantApiRegistryLocksTest < ApplicationIntegrationTest
|
|||
|
||||
def test_cannot_unlock_a_not_locked_domain
|
||||
delete '/api/v1/registrant/domains/2df2c1a1-8f6a-490a-81be-8bdf29866880/registry_lock',
|
||||
{}, @auth_headers
|
||||
headers: @auth_headers
|
||||
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
assert_equal(422, response.status)
|
||||
|
@ -81,8 +81,7 @@ class RegistrantApiRegistryLocksTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_returns_404_when_domain_is_not_found
|
||||
post '/api/v1/registrant/domains/random-uuid/registry_lock',
|
||||
{}, @auth_headers
|
||||
post '/api/v1/registrant/domains/random-uuid/registry_lock', headers: @auth_headers
|
||||
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
assert_equal(404, response.status)
|
||||
|
@ -99,7 +98,7 @@ class RegistrantApiRegistryLocksTest < ApplicationIntegrationTest
|
|||
assert_equal '1234', contact.ident
|
||||
assert_equal 'US', contact.ident_country_code
|
||||
|
||||
post api_v1_registrant_domain_registry_lock_path(domain.uuid), nil, @auth_headers
|
||||
post api_v1_registrant_domain_registry_lock_path(domain.uuid), headers: @auth_headers
|
||||
|
||||
assert_response :unauthorized
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
@ -109,7 +108,7 @@ class RegistrantApiRegistryLocksTest < ApplicationIntegrationTest
|
|||
|
||||
def test_registrant_can_lock_a_domain
|
||||
post '/api/v1/registrant/domains/1b3ee442-e8fe-4922-9492-8fcb9dccc69c/registry_lock',
|
||||
{}, @auth_headers
|
||||
headers: @auth_headers
|
||||
|
||||
assert_equal(200, response.status)
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
@ -125,7 +124,7 @@ class RegistrantApiRegistryLocksTest < ApplicationIntegrationTest
|
|||
assert_equal 'https://bestnames.test', @domain.registrar.website
|
||||
|
||||
post '/api/v1/registrant/domains/1b3ee442-e8fe-4922-9492-8fcb9dccc69c/registry_lock',
|
||||
{}, @auth_headers
|
||||
headers: @auth_headers
|
||||
|
||||
assert_equal(200, response.status)
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
|
|
@ -15,18 +15,18 @@ class ApiV1AuctionDetailsTest < ActionDispatch::IntegrationTest
|
|||
assert_equal 'auction.test', @auction.domain
|
||||
assert_equal Auction.statuses[:no_bids], @auction.status
|
||||
|
||||
get api_v1_auction_path(@auction.uuid), nil, 'Content-Type' => Mime::JSON.to_s
|
||||
get api_v1_auction_path(@auction.uuid), as: :json
|
||||
|
||||
assert_response :ok
|
||||
assert_equal ({ 'id' => '1b3ee442-e8fe-4922-9492-8fcb9dccc69c',
|
||||
'domain' => 'auction.test',
|
||||
'status' => Auction.statuses[:no_bids] }), ActiveSupport::JSON
|
||||
.decode(response.body)
|
||||
.decode(response.body)
|
||||
end
|
||||
|
||||
def test_auction_not_found
|
||||
assert_raises ActiveRecord::RecordNotFound do
|
||||
get api_v1_auction_path('non-existing-uuid'), nil, 'Content-Type' => Mime::JSON.to_s
|
||||
get api_v1_auction_path('non-existing-uuid'), as: :json
|
||||
end
|
||||
end
|
||||
end
|
|
@ -10,19 +10,19 @@ class ApiV1AuctionListTest < ActionDispatch::IntegrationTest
|
|||
domain: 'auction.test',
|
||||
status: Auction.statuses[:started])
|
||||
|
||||
get api_v1_auctions_path, nil, 'Content-Type' => Mime::JSON.to_s
|
||||
get api_v1_auctions_path, as: :json
|
||||
|
||||
assert_response :ok
|
||||
assert_equal ([{ 'id' => '1b3ee442-e8fe-4922-9492-8fcb9dccc69c',
|
||||
'domain' => 'auction.test',
|
||||
'status' => Auction.statuses[:started] }]), ActiveSupport::JSON
|
||||
.decode(response.body)
|
||||
.decode(response.body)
|
||||
end
|
||||
|
||||
def test_does_not_return_finished_auctions
|
||||
@auction.update!(domain: 'auction.test', status: Auction.statuses[:awaiting_payment])
|
||||
|
||||
get api_v1_auctions_path, nil, 'Content-Type' => Mime::JSON.to_s
|
||||
get api_v1_auctions_path, as: :json
|
||||
|
||||
assert_response :ok
|
||||
assert_empty ActiveSupport::JSON.decode(response.body)
|
||||
|
|
|
@ -20,47 +20,53 @@ class ApiV1AuctionUpdateTest < ActionDispatch::IntegrationTest
|
|||
assert_equal '1b3ee442-e8fe-4922-9492-8fcb9dccc69c', @auction.uuid
|
||||
assert_equal 'auction.test', @auction.domain
|
||||
|
||||
patch api_v1_auction_path(@auction.uuid), { status: Auction.statuses[:awaiting_payment] }
|
||||
.to_json, 'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_auction_path(@auction.uuid),
|
||||
params: { status: Auction.statuses[:awaiting_payment] },
|
||||
as: :json
|
||||
|
||||
assert_response :ok
|
||||
assert_equal ({ 'id' => '1b3ee442-e8fe-4922-9492-8fcb9dccc69c',
|
||||
'domain' => 'auction.test',
|
||||
'status' => Auction.statuses[:awaiting_payment] }), ActiveSupport::JSON
|
||||
.decode(response.body)
|
||||
.decode(response.body)
|
||||
end
|
||||
|
||||
def test_marks_as_awaiting_payment
|
||||
patch api_v1_auction_path(@auction.uuid), { status: Auction.statuses[:awaiting_payment] }
|
||||
.to_json, 'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_auction_path(@auction.uuid),
|
||||
params: { status: Auction.statuses[:awaiting_payment] },
|
||||
as: :json
|
||||
@auction.reload
|
||||
assert @auction.awaiting_payment?
|
||||
end
|
||||
|
||||
def test_marks_as_no_bids
|
||||
patch api_v1_auction_path(@auction.uuid), { status: Auction.statuses[:no_bids] }
|
||||
.to_json, 'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_auction_path(@auction.uuid),
|
||||
params: { status: Auction.statuses[:no_bids] },
|
||||
as: :json
|
||||
@auction.reload
|
||||
assert @auction.no_bids?
|
||||
end
|
||||
|
||||
def test_marks_as_payment_received
|
||||
patch api_v1_auction_path(@auction.uuid), { status: Auction.statuses[:payment_received] }
|
||||
.to_json, 'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_auction_path(@auction.uuid),
|
||||
params: { status: Auction.statuses[:payment_received] },
|
||||
as: :json
|
||||
@auction.reload
|
||||
assert @auction.payment_received?
|
||||
end
|
||||
|
||||
def test_marks_as_payment_not_received
|
||||
patch api_v1_auction_path(@auction.uuid), { status: Auction.statuses[:payment_not_received] }
|
||||
.to_json, 'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_auction_path(@auction.uuid),
|
||||
params: { status: Auction.statuses[:payment_not_received] },
|
||||
as: :json
|
||||
@auction.reload
|
||||
assert @auction.payment_not_received?
|
||||
end
|
||||
|
||||
def test_marks_as_domain_not_registered
|
||||
patch api_v1_auction_path(@auction.uuid), { status: Auction.statuses[:domain_not_registered] }
|
||||
.to_json, 'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_auction_path(@auction.uuid),
|
||||
params: { status: Auction.statuses[:domain_not_registered] },
|
||||
as: :json
|
||||
@auction.reload
|
||||
assert @auction.domain_not_registered?
|
||||
end
|
||||
|
@ -69,8 +75,9 @@ class ApiV1AuctionUpdateTest < ActionDispatch::IntegrationTest
|
|||
@auction.update!(registration_code: 'auction-001',
|
||||
status: Auction.statuses[:awaiting_payment])
|
||||
|
||||
patch api_v1_auction_path(@auction.uuid), { status: Auction.statuses[:payment_received] }
|
||||
.to_json, 'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_auction_path(@auction.uuid),
|
||||
params: { status: Auction.statuses[:payment_received] },
|
||||
as: :json
|
||||
|
||||
response_json = ActiveSupport::JSON.decode(response.body)
|
||||
assert_not_nil response_json['registration_code']
|
||||
|
@ -79,8 +86,9 @@ class ApiV1AuctionUpdateTest < ActionDispatch::IntegrationTest
|
|||
def test_conceals_registration_code_when_payment_is_not_received
|
||||
@auction.update!(status: Auction.statuses[:awaiting_payment])
|
||||
|
||||
patch api_v1_auction_path(@auction.uuid), { status: Auction.statuses[:payment_not_received] }
|
||||
.to_json, 'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_auction_path(@auction.uuid),
|
||||
params: { status: Auction.statuses[:payment_not_received] },
|
||||
as: :json
|
||||
|
||||
response_json = ActiveSupport::JSON.decode(response.body)
|
||||
assert_nil response_json['registration_code']
|
||||
|
@ -91,8 +99,9 @@ class ApiV1AuctionUpdateTest < ActionDispatch::IntegrationTest
|
|||
assert_equal 'auction.test', @auction.domain
|
||||
@whois_record.update!(updated_at: '2010-07-04')
|
||||
|
||||
patch api_v1_auction_path(@auction.uuid), { status: Auction.statuses[:payment_received] }
|
||||
.to_json, 'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_auction_path(@auction.uuid),
|
||||
params: { status: Auction.statuses[:payment_received] },
|
||||
as: :json
|
||||
@whois_record.reload
|
||||
|
||||
assert_equal Time.zone.parse('2010-07-05 10:00'), @whois_record.updated_at
|
||||
|
@ -103,8 +112,9 @@ class ApiV1AuctionUpdateTest < ActionDispatch::IntegrationTest
|
|||
assert_equal 'auction.test', @auction.domain
|
||||
@whois_record.delete
|
||||
|
||||
patch api_v1_auction_path(@auction.uuid), { status: Auction.statuses[:payment_received] }
|
||||
.to_json, 'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_auction_path(@auction.uuid),
|
||||
params: { status: Auction.statuses[:payment_received] },
|
||||
as: :json
|
||||
|
||||
new_whois_record = Whois::Record.find_by(name: @auction.domain)
|
||||
assert_equal Time.zone.parse('2010-07-05 10:00'), new_whois_record.updated_at
|
||||
|
@ -114,16 +124,16 @@ class ApiV1AuctionUpdateTest < ActionDispatch::IntegrationTest
|
|||
def test_inaccessible_when_ip_address_is_not_allowed
|
||||
ENV['auction_api_allowed_ips'] = ''
|
||||
|
||||
patch api_v1_auction_path(@auction.uuid), { status: 'any' }.to_json,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_auction_path(@auction.uuid), params: { status: 'any' }, as: :json
|
||||
|
||||
assert_response :unauthorized
|
||||
end
|
||||
|
||||
def test_auction_not_found
|
||||
assert_raises ActiveRecord::RecordNotFound do
|
||||
patch api_v1_auction_path('non-existing-uuid'), { status: Auction.statuses[:no_bids] }.to_json,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_auction_path('non-existing-uuid'),
|
||||
params: { status: Auction.statuses[:no_bids] },
|
||||
as: :json
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,8 +14,8 @@ class RegistrantApiV1ContactDetailsTest < ActionDispatch::IntegrationTest
|
|||
end
|
||||
|
||||
def test_returns_contact_details
|
||||
get api_v1_registrant_contact_path(@contact.uuid), nil, 'HTTP_AUTHORIZATION' => auth_token,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
get api_v1_registrant_contact_path(@contact.uuid), as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
|
||||
assert_response :ok
|
||||
assert_equal ({ id: @contact.uuid,
|
||||
|
@ -43,8 +43,8 @@ class RegistrantApiV1ContactDetailsTest < ActionDispatch::IntegrationTest
|
|||
end
|
||||
|
||||
def test_non_existent_contact
|
||||
get api_v1_registrant_contact_path('non-existent'), nil, 'HTTP_AUTHORIZATION' => auth_token,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
get api_v1_registrant_contact_path('non-existent'), as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
|
||||
assert_response :not_found
|
||||
assert_equal({ errors: [base: ['Contact not found']] }, JSON.parse(response.body,
|
||||
|
@ -52,7 +52,7 @@ class RegistrantApiV1ContactDetailsTest < ActionDispatch::IntegrationTest
|
|||
end
|
||||
|
||||
def test_anonymous_user
|
||||
get api_v1_registrant_contact_path(@contact.uuid), nil, 'Content-Type' => Mime::JSON.to_s
|
||||
get api_v1_registrant_contact_path(@contact.uuid)
|
||||
|
||||
assert_response :unauthorized
|
||||
assert_equal({ errors: [base: ['Not authorized']] }, JSON.parse(response.body,
|
||||
|
@ -66,8 +66,8 @@ class RegistrantApiV1ContactDetailsTest < ActionDispatch::IntegrationTest
|
|||
assert_equal 'US-1234', @user.registrant_ident
|
||||
|
||||
CompanyRegister::Client.stub(:new, CompanyRegisterClientStub.new) do
|
||||
get api_v1_registrant_contact_path(@contact.uuid), nil, 'HTTP_AUTHORIZATION' => auth_token,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
get api_v1_registrant_contact_path(@contact.uuid), as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
end
|
||||
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
@ -78,8 +78,8 @@ class RegistrantApiV1ContactDetailsTest < ActionDispatch::IntegrationTest
|
|||
assert_equal 'US-1234', @user.registrant_ident
|
||||
@contact.update!(ident: '12345')
|
||||
|
||||
get api_v1_registrant_contact_path(@contact.uuid), nil, 'HTTP_AUTHORIZATION' => auth_token,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
get api_v1_registrant_contact_path(@contact.uuid), as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
|
||||
assert_response :not_found
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
|
|
@ -20,8 +20,7 @@ class RegistrantApiV1ContactListTest < ActionDispatch::IntegrationTest
|
|||
assert_equal 'US', @contact.ident_country_code
|
||||
assert_equal 'US-1234', @user.registrant_ident
|
||||
|
||||
get api_v1_registrant_contacts_path, nil, 'HTTP_AUTHORIZATION' => auth_token,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
get api_v1_registrant_contacts_path, as: :json, headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
assert_equal 1, response_json.size
|
||||
|
@ -33,8 +32,7 @@ class RegistrantApiV1ContactListTest < ActionDispatch::IntegrationTest
|
|||
@contact = contacts(:acme_ltd)
|
||||
assert_equal 'acme-ltd-001', @contact.code
|
||||
|
||||
get api_v1_registrant_contacts_path, nil, 'HTTP_AUTHORIZATION' => auth_token,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
get api_v1_registrant_contacts_path, as: :json, headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
assert_equal 1, response_json.size
|
||||
|
@ -48,8 +46,8 @@ class RegistrantApiV1ContactListTest < ActionDispatch::IntegrationTest
|
|||
assert_equal 'US-1234', @user.registrant_ident
|
||||
|
||||
CompanyRegister::Client.stub(:new, CompanyRegisterClientStub.new) do
|
||||
get api_v1_registrant_contacts_path, nil, 'HTTP_AUTHORIZATION' => auth_token,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
get api_v1_registrant_contacts_path, as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
end
|
||||
|
||||
response_json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
|
|
@ -21,12 +21,11 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
|
|||
email: 'john@shop.test',
|
||||
phone: '+111.1')
|
||||
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), { name: 'William',
|
||||
email: 'william@shop.test',
|
||||
phone: '+222.2' }.to_json,
|
||||
'HTTP_AUTHORIZATION' => auth_token,
|
||||
'Accept' => Mime::JSON,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), params: { name: 'William',
|
||||
email: 'william@shop.test',
|
||||
phone: '+222.2' },
|
||||
as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
assert_response :ok
|
||||
@contact.reload
|
||||
|
||||
|
@ -37,10 +36,9 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
|
|||
|
||||
def test_notify_registrar
|
||||
assert_difference -> { @contact.registrar.notifications.count } do
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), { name: 'new name' }.to_json,
|
||||
'HTTP_AUTHORIZATION' => auth_token,
|
||||
'Accept' => Mime::JSON,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), params: { name: 'new name' },
|
||||
as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
end
|
||||
notification = @contact.registrar.notifications.last
|
||||
assert_equal 'Contact john-001 has been updated by registrant', notification.text
|
||||
|
@ -50,10 +48,9 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
|
|||
@contact.update!(fax: '+666.6')
|
||||
ENV['fax_enabled'] = 'true'
|
||||
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), { fax: '+777.7' }.to_json,
|
||||
'HTTP_AUTHORIZATION' => auth_token,
|
||||
'Accept' => Mime::JSON,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), params: { fax: '+777.7' },
|
||||
as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
|
||||
assert_response :ok
|
||||
@contact.reload
|
||||
|
@ -63,10 +60,9 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
|
|||
def test_fax_cannot_be_updated_when_disabled
|
||||
ENV['fax_enabled'] = 'false'
|
||||
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), { fax: '+823.7' }.to_json,
|
||||
'HTTP_AUTHORIZATION' => auth_token,
|
||||
'Accept' => Mime::JSON,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), params: { fax: '+823.7' },
|
||||
as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
|
||||
assert_response :bad_request
|
||||
@contact.reload
|
||||
|
@ -80,14 +76,13 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
|
|||
def test_update_address_when_enabled
|
||||
Setting.address_processing = true
|
||||
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), { address: { city: 'new city',
|
||||
street: 'new street',
|
||||
zip: '92837',
|
||||
country_code: 'RU',
|
||||
state: 'new state' } }.to_json,
|
||||
'HTTP_AUTHORIZATION' => auth_token,
|
||||
'Accept' => Mime::JSON,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), params: { address: { city: 'new city',
|
||||
street: 'new street',
|
||||
zip: '92837',
|
||||
country_code: 'RU',
|
||||
state: 'new state' } },
|
||||
as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
|
||||
assert_response :ok
|
||||
@contact.reload
|
||||
|
@ -99,10 +94,9 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
|
|||
@contact.update!(street: 'any', zip: 'any', city: 'any', state: 'any', country_code: 'US')
|
||||
Setting.address_processing = true
|
||||
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), { name: 'any' }.to_json,
|
||||
'HTTP_AUTHORIZATION' => auth_token,
|
||||
'Accept' => Mime::JSON,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), params: { name: 'any' },
|
||||
as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
|
||||
assert_response :ok
|
||||
end
|
||||
|
@ -111,11 +105,10 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
|
|||
@contact.update!(street: 'old street')
|
||||
Setting.address_processing = false
|
||||
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), { address: { street: 'new street' } }
|
||||
.to_json,
|
||||
'HTTP_AUTHORIZATION' => auth_token,
|
||||
'Accept' => Mime::JSON,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_registrant_contact_path(@contact.uuid),
|
||||
params: { address: { street: 'new street' } },
|
||||
as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
@contact.reload
|
||||
|
||||
assert_response :bad_request
|
||||
|
@ -130,10 +123,10 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
|
|||
@contact.update!(ident_type: Contact::PRIV,
|
||||
disclosed_attributes: %w[])
|
||||
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), { disclosed_attributes: %w[name] }.to_json,
|
||||
'HTTP_AUTHORIZATION' => auth_token,
|
||||
'Accept' => Mime::JSON,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_registrant_contact_path(@contact.uuid),
|
||||
params: { disclosed_attributes: %w[name] },
|
||||
as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
@contact.reload
|
||||
|
||||
assert_response :ok
|
||||
|
@ -143,10 +136,10 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
|
|||
def test_conceal_private_persons_data
|
||||
@contact.update!(ident_type: Contact::PRIV, disclosed_attributes: %w[name])
|
||||
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), { disclosed_attributes: [] }.to_json,
|
||||
{ 'HTTP_AUTHORIZATION' => auth_token,
|
||||
'Accept' => Mime::JSON,
|
||||
'Content-Type' => Mime::JSON.to_s }
|
||||
patch api_v1_registrant_contact_path(@contact.uuid),
|
||||
params: { disclosed_attributes: [] },
|
||||
as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
|
||||
@contact.reload
|
||||
|
||||
|
@ -166,11 +159,10 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
|
|||
assert_equal 'US-1234', @user.registrant_ident
|
||||
|
||||
assert_no_changes -> { @contact.disclosed_attributes } do
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), { disclosed_attributes: %w[name] }
|
||||
.to_json,
|
||||
'HTTP_AUTHORIZATION' => auth_token,
|
||||
'Accept' => Mime::JSON,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_registrant_contact_path(@contact.uuid),
|
||||
params: { disclosed_attributes: %w[name] },
|
||||
as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
@contact.reload
|
||||
end
|
||||
assert_response :bad_request
|
||||
|
@ -182,10 +174,9 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
|
|||
end
|
||||
|
||||
def test_return_contact_details
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), { name: 'new name' }.to_json,
|
||||
'HTTP_AUTHORIZATION' => auth_token,
|
||||
'Accept' => Mime::JSON,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), params: { name: 'new name' },
|
||||
as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
assert_equal ({ id: @contact.uuid,
|
||||
name: 'new name',
|
||||
code: @contact.code,
|
||||
|
@ -211,10 +202,9 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
|
|||
end
|
||||
|
||||
def test_errors
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), { phone: 'invalid' }.to_json,
|
||||
'HTTP_AUTHORIZATION' => auth_token,
|
||||
'Accept' => Mime::JSON,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), params: { phone: 'invalid' },
|
||||
as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
|
||||
assert_response :bad_request
|
||||
assert_equal ({ errors: { phone: ['Phone nr is invalid'] } }), JSON.parse(response.body,
|
||||
|
@ -225,10 +215,9 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
|
|||
assert_equal 'US-1234', @user.registrant_ident
|
||||
@contact.update!(ident: '12345')
|
||||
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), { name: 'new name' }.to_json,
|
||||
'HTTP_AUTHORIZATION' => auth_token,
|
||||
'Accept' => Mime::JSON,
|
||||
'Content-Type' => Mime::JSON.to_s
|
||||
patch api_v1_registrant_contact_path(@contact.uuid), params: { name: 'new name' },
|
||||
as: :json,
|
||||
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
@contact.reload
|
||||
|
||||
assert_response :not_found
|
||||
|
@ -236,7 +225,8 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
|
|||
end
|
||||
|
||||
def test_non_existent_contact
|
||||
patch api_v1_registrant_contact_path('non-existent'), nil, 'HTTP_AUTHORIZATION' => auth_token
|
||||
patch api_v1_registrant_contact_path('non-existent'),
|
||||
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||
assert_response :not_found
|
||||
assert_equal ({ errors: [{ base: ['Not found'] }] }),
|
||||
JSON.parse(response.body, symbolize_names: true)
|
||||
|
|
|
@ -15,8 +15,8 @@ class EppBaseTest < EppTestCase
|
|||
|
||||
begin
|
||||
assert_difference 'ApiLog::EppLog.count' do
|
||||
post '/epp/command/internal_error', { frame: valid_request_xml },
|
||||
'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post '/epp/command/internal_error', params: { frame: valid_request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
end
|
||||
assert_epp_response :command_failed
|
||||
rescue
|
||||
|
@ -32,7 +32,8 @@ class EppBaseTest < EppTestCase
|
|||
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
||||
</epp>
|
||||
XML
|
||||
post valid_command_path, { frame: invalid_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post valid_command_path, params: { frame: invalid_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
assert_epp_response :syntax_error
|
||||
end
|
||||
|
@ -50,8 +51,8 @@ class EppBaseTest < EppTestCase
|
|||
</command>
|
||||
</epp>
|
||||
XML
|
||||
post epp_info_path, { frame: xml_of_epp_command_that_requires_authentication },
|
||||
'HTTP_COOKIE' => 'session=non-existent'
|
||||
post epp_info_path, params: { frame: xml_of_epp_command_that_requires_authentication },
|
||||
headers: { 'HTTP_COOKIE' => 'session=non-existent' }
|
||||
|
||||
assert_epp_response :authorization_error
|
||||
end
|
||||
|
@ -74,8 +75,8 @@ class EppBaseTest < EppTestCase
|
|||
</command>
|
||||
</epp>
|
||||
XML
|
||||
post epp_info_path, { frame: xml_of_epp_command_that_requires_authorization },
|
||||
'HTTP_COOKIE' => "session=#{session.session_id}"
|
||||
post epp_info_path, params: { frame: xml_of_epp_command_that_requires_authorization },
|
||||
headers: { 'HTTP_COOKIE' => "session=#{session.session_id}" }
|
||||
|
||||
assert_epp_response :authorization_error
|
||||
end
|
||||
|
|
|
@ -14,7 +14,8 @@ class EppContactBaseTest < EppTestCase
|
|||
</command>
|
||||
</epp>
|
||||
XML
|
||||
post epp_info_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_info_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
assert_epp_response :object_does_not_exist
|
||||
end
|
||||
|
|
|
@ -21,7 +21,8 @@ class EppContactCheckBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_check_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_epp_response :completed_successfully
|
||||
|
@ -42,7 +43,8 @@ class EppContactCheckBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_check_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_equal '1', response_xml.at_xpath('//contact:id', contact: xml_schema)['avail']
|
||||
|
@ -65,7 +67,8 @@ class EppContactCheckBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_check_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_equal '0', response_xml.at_xpath('//contact:id', contact: xml_schema)['avail']
|
||||
|
@ -88,7 +91,8 @@ class EppContactCheckBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_check_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_equal 3, response_xml.xpath('//contact:cd', contact: xml_schema).size
|
||||
|
|
|
@ -29,7 +29,8 @@ class EppContactCreateBaseTest < EppTestCase
|
|||
XML
|
||||
|
||||
assert_difference 'Contact.count' do
|
||||
post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_create_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
end
|
||||
|
||||
assert_epp_response :completed_successfully
|
||||
|
@ -68,7 +69,8 @@ class EppContactCreateBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => "session=#{session.session_id}"
|
||||
post epp_create_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => "session=#{session.session_id}" }
|
||||
|
||||
contact = Contact.find_by(name: name)
|
||||
assert_equal "#{session.user.registrar.code}:#{code}".upcase, contact.code
|
||||
|
@ -98,7 +100,8 @@ class EppContactCreateBaseTest < EppTestCase
|
|||
XML
|
||||
|
||||
assert_no_difference 'Contact.count' do
|
||||
post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_create_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
end
|
||||
assert_epp_response :required_parameter_missing
|
||||
end
|
||||
|
|
|
@ -21,7 +21,8 @@ class EppContactDeleteBaseTest < EppTestCase
|
|||
XML
|
||||
|
||||
assert_difference 'Contact.count', -1 do
|
||||
post epp_delete_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_delete_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
end
|
||||
assert_epp_response :completed_successfully
|
||||
end
|
||||
|
@ -47,7 +48,8 @@ class EppContactDeleteBaseTest < EppTestCase
|
|||
XML
|
||||
|
||||
assert_no_difference 'Contact.count' do
|
||||
post epp_delete_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_delete_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
end
|
||||
assert_epp_response :object_association_prohibits_operation
|
||||
end
|
||||
|
@ -55,7 +57,7 @@ class EppContactDeleteBaseTest < EppTestCase
|
|||
private
|
||||
|
||||
def deletable_contact
|
||||
Domain.update_all(registrant_id: contacts(:william))
|
||||
Domain.update_all(registrant_id: contacts(:william).id)
|
||||
DomainContact.delete_all
|
||||
contacts(:john)
|
||||
end
|
||||
|
|
|
@ -29,7 +29,8 @@ class EppContactInfoBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_info_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_info_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_epp_response :completed_successfully
|
||||
|
|
|
@ -16,7 +16,8 @@ class EppContactTransferBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_transfer_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_transfer_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
assert_epp_response :unimplemented
|
||||
end
|
||||
|
|
|
@ -37,7 +37,8 @@ class EppContactUpdateBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_update_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
@contact.reload
|
||||
|
||||
assert_epp_response :completed_successfully
|
||||
|
@ -69,7 +70,8 @@ class EppContactUpdateBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_update_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
assert_emails 1
|
||||
end
|
||||
|
@ -97,7 +99,8 @@ class EppContactUpdateBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_update_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
assert_no_emails
|
||||
end
|
||||
|
@ -128,7 +131,8 @@ class EppContactUpdateBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_update_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
assert_no_emails
|
||||
end
|
||||
|
@ -154,7 +158,8 @@ class EppContactUpdateBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_update_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
assert_epp_response :object_does_not_exist
|
||||
end
|
||||
|
@ -188,7 +193,8 @@ class EppContactUpdateBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
assert_no_changes -> { @contact.updated_at } do
|
||||
post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_update_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
end
|
||||
assert_epp_response :data_management_policy_violation
|
||||
end
|
||||
|
@ -220,7 +226,8 @@ class EppContactUpdateBaseTest < EppTestCase
|
|||
</command>
|
||||
</epp>
|
||||
XML
|
||||
post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_update_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
assert_epp_response :completed_successfully
|
||||
end
|
||||
|
@ -230,6 +237,6 @@ class EppContactUpdateBaseTest < EppTestCase
|
|||
def make_contact_free_of_domains_where_it_acts_as_a_registrant(contact)
|
||||
other_contact = contacts(:william)
|
||||
assert_not_equal other_contact, contact
|
||||
Domain.update_all(registrant_id: other_contact)
|
||||
Domain.update_all(registrant_id: other_contact.id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,7 +14,8 @@ class EppDomainBaseTest < EppTestCase
|
|||
</command>
|
||||
</epp>
|
||||
XML
|
||||
post epp_info_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_info_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
assert_epp_response :object_does_not_exist
|
||||
end
|
||||
|
|
|
@ -28,7 +28,8 @@ class EppDomainCheckAuctionTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_check_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_epp_response :completed_successfully
|
||||
|
@ -52,7 +53,8 @@ class EppDomainCheckAuctionTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_check_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_epp_response :completed_successfully
|
||||
|
@ -76,7 +78,8 @@ class EppDomainCheckAuctionTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_check_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_epp_response :completed_successfully
|
||||
|
@ -100,7 +103,8 @@ class EppDomainCheckAuctionTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_check_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_epp_response :completed_successfully
|
||||
|
@ -124,7 +128,8 @@ class EppDomainCheckAuctionTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_check_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_epp_response :completed_successfully
|
||||
|
|
|
@ -15,7 +15,8 @@ class EppDomainCheckBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_check_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_epp_response :completed_successfully
|
||||
|
@ -36,7 +37,8 @@ class EppDomainCheckBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_check_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_equal '1', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['avail']
|
||||
|
@ -59,7 +61,8 @@ class EppDomainCheckBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_check_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_equal '1', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['avail']
|
||||
|
@ -80,7 +83,8 @@ class EppDomainCheckBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_check_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['avail']
|
||||
|
@ -103,7 +107,8 @@ class EppDomainCheckBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_check_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['avail']
|
||||
|
@ -126,7 +131,8 @@ class EppDomainCheckBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_check_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['avail']
|
||||
|
@ -149,7 +155,8 @@ class EppDomainCheckBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_check_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['avail']
|
||||
|
@ -172,7 +179,8 @@ class EppDomainCheckBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_check_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_equal 3, response_xml.xpath('//domain:cd', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').size
|
||||
|
|
|
@ -39,7 +39,8 @@ class EppDomainCreateAuctionIdnTest < EppTestCase
|
|||
XML
|
||||
|
||||
assert_no_difference 'Domain.count' do
|
||||
post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_create_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
end
|
||||
|
||||
refute Domain.where(name: @idn_auction.domain).exists?
|
||||
|
@ -73,7 +74,8 @@ class EppDomainCreateAuctionIdnTest < EppTestCase
|
|||
XML
|
||||
|
||||
assert_no_difference 'Domain.count' do
|
||||
post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_create_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames'}
|
||||
end
|
||||
|
||||
refute Domain.where(name: @idn_auction.domain).exists?
|
||||
|
@ -106,7 +108,8 @@ class EppDomainCreateAuctionIdnTest < EppTestCase
|
|||
XML
|
||||
|
||||
assert_no_difference 'Domain.count' do
|
||||
post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_create_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames'}
|
||||
end
|
||||
|
||||
refute Domain.where(name: @idn_auction.domain).exists?
|
||||
|
@ -139,7 +142,8 @@ class EppDomainCreateAuctionIdnTest < EppTestCase
|
|||
XML
|
||||
|
||||
assert_no_difference 'Domain.count' do
|
||||
post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_create_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames'}
|
||||
end
|
||||
|
||||
refute Domain.where(name: @idn_auction.domain).exists?
|
||||
|
@ -176,7 +180,8 @@ class EppDomainCreateAuctionIdnTest < EppTestCase
|
|||
XML
|
||||
|
||||
assert_difference 'Domain.count' do
|
||||
post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_create_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames'}
|
||||
end
|
||||
|
||||
@idn_auction.reload
|
||||
|
@ -212,7 +217,8 @@ class EppDomainCreateAuctionIdnTest < EppTestCase
|
|||
XML
|
||||
|
||||
assert_difference 'Domain.count' do
|
||||
post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_create_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames'}
|
||||
end
|
||||
|
||||
@idn_auction.reload
|
||||
|
|
|
@ -31,7 +31,8 @@ class EppDomainCreateAuctionTest < EppTestCase
|
|||
XML
|
||||
|
||||
assert_difference 'Domain.count' do
|
||||
post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_create_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
end
|
||||
assert_epp_response :completed_successfully
|
||||
end
|
||||
|
@ -68,7 +69,8 @@ class EppDomainCreateAuctionTest < EppTestCase
|
|||
XML
|
||||
|
||||
assert_difference 'Domain.count' do
|
||||
post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_create_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
end
|
||||
assert_epp_response :completed_successfully
|
||||
end
|
||||
|
@ -100,7 +102,8 @@ class EppDomainCreateAuctionTest < EppTestCase
|
|||
XML
|
||||
|
||||
assert_difference 'Domain.count' do
|
||||
post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_create_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
end
|
||||
|
||||
@auction.reload
|
||||
|
@ -132,7 +135,8 @@ class EppDomainCreateAuctionTest < EppTestCase
|
|||
XML
|
||||
|
||||
assert_no_difference 'Domain.count' do
|
||||
post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_create_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
end
|
||||
assert_epp_response :required_parameter_missing
|
||||
end
|
||||
|
@ -164,7 +168,8 @@ class EppDomainCreateAuctionTest < EppTestCase
|
|||
XML
|
||||
|
||||
assert_no_difference 'Domain.count' do
|
||||
post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_create_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
end
|
||||
assert_epp_response :invalid_authorization_information
|
||||
end
|
||||
|
@ -195,7 +200,8 @@ class EppDomainCreateAuctionTest < EppTestCase
|
|||
XML
|
||||
|
||||
assert_no_difference 'Domain.count' do
|
||||
post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_create_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
end
|
||||
assert_epp_response :required_parameter_missing
|
||||
end
|
||||
|
@ -222,7 +228,8 @@ class EppDomainCreateAuctionTest < EppTestCase
|
|||
XML
|
||||
|
||||
assert_no_difference 'Domain.count' do
|
||||
post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_create_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
end
|
||||
assert_epp_response :parameter_value_policy_error
|
||||
end
|
||||
|
|
|
@ -28,7 +28,8 @@ class EppDomainCreateBaseTest < EppTestCase
|
|||
XML
|
||||
|
||||
assert_difference 'Domain.count' do
|
||||
post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_create_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
end
|
||||
|
||||
assert_epp_response :completed_successfully
|
||||
|
@ -71,7 +72,8 @@ class EppDomainCreateBaseTest < EppTestCase
|
|||
XML
|
||||
|
||||
assert_difference 'Domain.count' do
|
||||
post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_create_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
end
|
||||
assert_epp_response :completed_successfully
|
||||
|
||||
|
@ -105,7 +107,8 @@ class EppDomainCreateBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_create_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
assert_epp_response :completed_successfully
|
||||
assert_equal transfer_code, Domain.find_by(name: name).transfer_code
|
||||
|
@ -135,7 +138,8 @@ class EppDomainCreateBaseTest < EppTestCase
|
|||
XML
|
||||
|
||||
assert_no_difference 'Domain.count' do
|
||||
post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_create_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
end
|
||||
assert_epp_response :data_management_policy_violation
|
||||
end
|
||||
|
@ -164,7 +168,8 @@ class EppDomainCreateBaseTest < EppTestCase
|
|||
XML
|
||||
|
||||
assert_no_difference 'Domain.count' do
|
||||
post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_create_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
end
|
||||
assert_epp_response :invalid_authorization_information
|
||||
end
|
||||
|
@ -192,7 +197,8 @@ class EppDomainCreateBaseTest < EppTestCase
|
|||
XML
|
||||
|
||||
assert_no_difference 'Domain.count' do
|
||||
post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_create_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
end
|
||||
assert_epp_response :required_parameter_missing
|
||||
end
|
||||
|
@ -220,7 +226,8 @@ class EppDomainCreateBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
assert_no_difference 'Domain.count' do
|
||||
post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => "session=#{session.session_id}"
|
||||
post epp_create_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => "session=#{session.session_id}" }
|
||||
end
|
||||
assert_epp_response :billing_failure
|
||||
end
|
||||
|
@ -248,7 +255,8 @@ class EppDomainCreateBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
assert_no_difference 'Domain.count' do
|
||||
post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_create_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
end
|
||||
assert_epp_response :billing_failure
|
||||
end
|
||||
|
|
|
@ -34,7 +34,7 @@ class EppDomainDeleteBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_delete_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_delete_path, params: { frame: request_xml }, headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
assert_includes Domain.find_by(name: 'invalid.test').statuses, DomainStatus::PENDING_DELETE_CONFIRMATION
|
||||
assert_epp_response :completed_successfully_action_pending
|
||||
end
|
||||
|
@ -62,7 +62,7 @@ class EppDomainDeleteBaseTest < EppTestCase
|
|||
XML
|
||||
|
||||
assert_no_difference 'Domain.count' do
|
||||
post epp_delete_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_delete_path, params: { frame: request_xml }, headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
end
|
||||
assert_epp_response :object_status_prohibits_operation
|
||||
end
|
||||
|
@ -89,7 +89,7 @@ class EppDomainDeleteBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_delete_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_delete_path, params: { frame: request_xml }, headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
@domain.reload
|
||||
|
||||
assert @domain.registrant_verification_asked?
|
||||
|
@ -120,7 +120,7 @@ class EppDomainDeleteBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_delete_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_delete_path, params: { frame: request_xml }, headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
@domain.reload
|
||||
|
||||
assert_not @domain.registrant_verification_asked?
|
||||
|
@ -151,7 +151,7 @@ class EppDomainDeleteBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_delete_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_delete_path, params: { frame: request_xml }, headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
@domain.reload
|
||||
|
||||
assert_not @domain.registrant_verification_asked?
|
||||
|
@ -176,7 +176,7 @@ class EppDomainDeleteBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_delete_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_delete_path, params: { frame: request_xml }, headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
assert_epp_response :required_parameter_missing
|
||||
end
|
||||
|
@ -203,7 +203,7 @@ class EppDomainDeleteBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_delete_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_delete_path, params: { frame: request_xml }, headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
assert_epp_response :object_status_prohibits_operation
|
||||
end
|
||||
|
|
|
@ -21,7 +21,8 @@ class EppDomainInfoBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_info_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_info_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_epp_response :completed_successfully
|
||||
|
@ -49,7 +50,8 @@ class EppDomainInfoBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_info_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_info_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_equal '65078d5', response_xml.at_xpath('//domain:authInfo/domain:pw', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text
|
||||
|
@ -76,7 +78,8 @@ class EppDomainInfoBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_info_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_goodnames'
|
||||
post epp_info_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
|
||||
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_equal '65078d5', response_xml.at_xpath('//domain:authInfo/domain:pw', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text
|
||||
|
@ -99,7 +102,8 @@ class EppDomainInfoBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_info_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_goodnames'
|
||||
post epp_info_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
|
||||
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_nil response_xml.at_xpath('//domain:authInfo/domain:pw',
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class EppDomainRenewBaseTest < EppTestCase
|
||||
self.use_transactional_fixtures = false
|
||||
self.use_transactional_tests = false
|
||||
|
||||
def test_renews_domain
|
||||
travel_to Time.zone.parse('2010-07-05')
|
||||
|
@ -24,7 +24,8 @@ class EppDomainRenewBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_renew_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_renew_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
domain.reload
|
||||
|
||||
assert_epp_response :completed_successfully
|
||||
|
@ -50,7 +51,8 @@ class EppDomainRenewBaseTest < EppTestCase
|
|||
XML
|
||||
|
||||
assert_no_changes -> { domain.valid_to } do
|
||||
post epp_renew_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_renew_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
domain.reload
|
||||
end
|
||||
assert_epp_response :object_status_prohibits_operation
|
||||
|
@ -77,8 +79,8 @@ class EppDomainRenewBaseTest < EppTestCase
|
|||
XML
|
||||
|
||||
assert_no_changes -> { domain.valid_to } do
|
||||
post epp_renew_path, { frame: request_xml },
|
||||
'HTTP_COOKIE' => "session=#{session.session_id}"
|
||||
post epp_renew_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => "session=#{session.session_id}" }
|
||||
domain.reload
|
||||
end
|
||||
assert_epp_response :authorization_error
|
||||
|
@ -105,8 +107,8 @@ class EppDomainRenewBaseTest < EppTestCase
|
|||
XML
|
||||
|
||||
assert_no_difference -> { domain.valid_to } do
|
||||
post epp_renew_path, { frame: request_xml }, 'HTTP_COOKIE' =>
|
||||
"session=#{session.session_id}"
|
||||
post epp_renew_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => "session=#{session.session_id}" }
|
||||
domain.reload
|
||||
end
|
||||
assert_epp_response :billing_failure
|
||||
|
@ -132,7 +134,8 @@ class EppDomainRenewBaseTest < EppTestCase
|
|||
XML
|
||||
|
||||
assert_no_changes -> { domain.valid_to } do
|
||||
post epp_renew_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_renew_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
domain.reload
|
||||
end
|
||||
assert_epp_response :billing_failure
|
||||
|
@ -158,7 +161,8 @@ class EppDomainRenewBaseTest < EppTestCase
|
|||
XML
|
||||
|
||||
assert_no_changes -> { domain.valid_to } do
|
||||
post epp_renew_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_renew_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
domain.reload
|
||||
end
|
||||
assert_epp_response :parameter_value_policy_error
|
||||
|
|
|
@ -2,7 +2,8 @@ require 'test_helper'
|
|||
|
||||
class EppDomainTransferQueryTest < EppTestCase
|
||||
def test_returns_domain_transfer_details
|
||||
post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
post epp_transfer_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
xml_doc = Nokogiri::XML(response.body)
|
||||
assert_epp_response :completed_successfully
|
||||
assert_equal 'shop.test', xml_doc.xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text
|
||||
|
@ -28,14 +29,16 @@ class EppDomainTransferQueryTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
post epp_transfer_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
assert_epp_response :invalid_authorization_information
|
||||
end
|
||||
|
||||
def test_no_domain_transfer
|
||||
domains(:shop).transfers.delete_all
|
||||
post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
post epp_transfer_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
assert_epp_response :object_does_not_exist
|
||||
end
|
||||
|
||||
|
|
|
@ -13,24 +13,28 @@ class EppDomainTransferRequestTest < EppTestCase
|
|||
end
|
||||
|
||||
def test_transfers_domain_at_once
|
||||
post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
|
||||
post epp_transfer_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
|
||||
assert_epp_response :completed_successfully
|
||||
end
|
||||
|
||||
def test_creates_new_domain_transfer
|
||||
assert_difference -> { @domain.transfers.size } do
|
||||
post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
|
||||
post epp_transfer_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
|
||||
end
|
||||
end
|
||||
|
||||
def test_approves_automatically_if_auto_approval_is_enabled
|
||||
post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
|
||||
post epp_transfer_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
|
||||
assert_equal 'serverApproved', Nokogiri::XML(response.body).xpath('//domain:trStatus', 'domain' =>
|
||||
'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text
|
||||
end
|
||||
|
||||
def test_assigns_new_registrar
|
||||
post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
|
||||
post epp_transfer_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
|
||||
@domain.reload
|
||||
assert_equal @new_registrar, @domain.registrar
|
||||
end
|
||||
|
@ -38,7 +42,8 @@ class EppDomainTransferRequestTest < EppTestCase
|
|||
def test_regenerates_transfer_code
|
||||
@old_transfer_code = @domain.transfer_code
|
||||
|
||||
post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
|
||||
post epp_transfer_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
|
||||
|
||||
@domain.reload
|
||||
refute_equal @domain.transfer_code, @old_transfer_code
|
||||
|
@ -48,31 +53,36 @@ class EppDomainTransferRequestTest < EppTestCase
|
|||
@old_registrar = @domain.registrar
|
||||
|
||||
assert_difference -> { @old_registrar.notifications.count } do
|
||||
post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
|
||||
post epp_transfer_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
|
||||
end
|
||||
end
|
||||
|
||||
def test_duplicates_registrant_admin_and_tech_contacts
|
||||
assert_difference -> { @new_registrar.contacts.size }, 3 do
|
||||
post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
|
||||
post epp_transfer_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
|
||||
end
|
||||
end
|
||||
|
||||
def test_reuses_identical_contact
|
||||
post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
|
||||
post epp_transfer_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
|
||||
assert_equal 1, @new_registrar.contacts.where(name: 'William').size
|
||||
end
|
||||
|
||||
def test_saves_legal_document
|
||||
assert_difference -> { @domain.legal_documents(true).size } do
|
||||
post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
|
||||
assert_difference -> { @domain.legal_documents.reload.size } do
|
||||
post epp_transfer_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
|
||||
end
|
||||
end
|
||||
|
||||
def test_non_transferable_domain
|
||||
@domain.update!(statuses: [DomainStatus::SERVER_TRANSFER_PROHIBITED])
|
||||
|
||||
post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
|
||||
post epp_transfer_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
|
||||
domains(:shop).reload
|
||||
|
||||
assert_equal registrars(:bestnames), domains(:shop).registrar
|
||||
|
@ -82,7 +92,8 @@ class EppDomainTransferRequestTest < EppTestCase
|
|||
def test_discarded_domain_cannot_be_transferred
|
||||
@domain.update!(statuses: [DomainStatus::DELETE_CANDIDATE])
|
||||
|
||||
post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
|
||||
post epp_transfer_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
|
||||
@domain.reload
|
||||
|
||||
assert_equal registrars(:bestnames), @domain.registrar
|
||||
|
@ -91,7 +102,8 @@ class EppDomainTransferRequestTest < EppTestCase
|
|||
|
||||
def test_same_registrar
|
||||
assert_no_difference -> { @domain.transfers.size } do
|
||||
post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
post epp_transfer_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
end
|
||||
assert_epp_response :use_error
|
||||
end
|
||||
|
@ -113,7 +125,8 @@ class EppDomainTransferRequestTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
|
||||
post epp_transfer_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
|
||||
@domain.reload
|
||||
|
||||
assert_epp_response :invalid_authorization_information
|
||||
|
|
|
@ -34,7 +34,8 @@ class EppDomainUpdateBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_update_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
@domain.reload
|
||||
assert_equal 'f0ff7d17b0', @domain.transfer_code
|
||||
assert_epp_response :completed_successfully
|
||||
|
@ -56,7 +57,8 @@ class EppDomainUpdateBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_update_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
assert_epp_response :object_status_prohibits_operation
|
||||
end
|
||||
|
||||
|
@ -76,7 +78,8 @@ class EppDomainUpdateBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_update_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
assert_epp_response :object_status_prohibits_operation
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
|
@ -109,7 +112,8 @@ class EppDomainUpdateBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_update_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
@domain.reload
|
||||
|
||||
assert_epp_response :completed_successfully_action_pending
|
||||
|
@ -145,7 +149,8 @@ class EppDomainUpdateBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_update_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
@domain.reload
|
||||
|
||||
assert_epp_response :completed_successfully_action_pending
|
||||
|
@ -179,7 +184,8 @@ class EppDomainUpdateBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_update_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
@domain.reload
|
||||
|
||||
assert_epp_response :completed_successfully
|
||||
|
@ -214,7 +220,8 @@ class EppDomainUpdateBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_update_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
@domain.reload
|
||||
|
||||
assert_epp_response :completed_successfully
|
||||
|
@ -250,7 +257,8 @@ class EppDomainUpdateBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_update_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
@domain.reload
|
||||
|
||||
assert_epp_response :completed_successfully
|
||||
|
@ -287,7 +295,8 @@ class EppDomainUpdateBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_update_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
@domain.reload
|
||||
|
||||
assert_epp_response :completed_successfully
|
||||
|
|
|
@ -9,7 +9,8 @@ class EppHelloTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
get epp_hello_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=non-existent'
|
||||
get epp_hello_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=non-existent' }
|
||||
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_equal 'EPP server (EIS)', response_xml.at_css('greeting > svID').text
|
||||
|
|
|
@ -23,7 +23,8 @@ class EppLoginCredentialsTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_login_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=new_session_id' }
|
||||
post epp_login_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=new_session_id' }
|
||||
assert EppSession.find_by(session_id: 'new_session_id')
|
||||
assert_equal users(:api_bestnames), EppSession.find_by(session_id: 'new_session_id').user
|
||||
assert_epp_response :completed_successfully
|
||||
|
@ -55,7 +56,8 @@ class EppLoginCredentialsTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_login_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=any_random_string'
|
||||
post epp_login_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=any_random_string' }
|
||||
|
||||
assert_epp_response :authentication_error_server_closing_connection
|
||||
end
|
||||
|
|
|
@ -24,7 +24,8 @@ class EppLoginPasswordChangeTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_login_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=new_session_id' }
|
||||
post epp_login_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=new_session_id' }
|
||||
assert_equal 'new-password', users(:api_bestnames).plain_text_password
|
||||
assert_epp_response :completed_successfully
|
||||
end
|
||||
|
|
|
@ -14,7 +14,8 @@ class EppLoginSessionLimitTest < EppTestCase
|
|||
end
|
||||
|
||||
assert_difference 'EppSession.count' do
|
||||
post epp_login_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=new_session_id' }
|
||||
post epp_login_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=new_session_id' }
|
||||
end
|
||||
assert_epp_response :completed_successfully
|
||||
end
|
||||
|
@ -27,7 +28,8 @@ class EppLoginSessionLimitTest < EppTestCase
|
|||
end
|
||||
|
||||
assert_no_difference 'EppSession.count' do
|
||||
post epp_login_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=new_session_id' }
|
||||
post epp_login_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=new_session_id' }
|
||||
end
|
||||
assert_epp_response :authentication_error_server_closing_connection
|
||||
end
|
||||
|
|
|
@ -2,22 +2,26 @@ require 'test_helper'
|
|||
|
||||
class EppLogoutTest < EppTestCase
|
||||
def test_success_response
|
||||
post epp_logout_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
post epp_logout_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
assert_epp_response :completed_successfully_ending_session
|
||||
end
|
||||
|
||||
def test_ends_current_session
|
||||
post epp_logout_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
post epp_logout_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
assert_nil EppSession.find_by(session_id: 'api_bestnames')
|
||||
end
|
||||
|
||||
def test_keeps_other_sessions_intact
|
||||
post epp_logout_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
post epp_logout_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
assert EppSession.find_by(session_id: 'api_goodnames')
|
||||
end
|
||||
|
||||
def test_anonymous_user
|
||||
post epp_logout_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=non-existent' }
|
||||
post epp_logout_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=non-existent' }
|
||||
assert_epp_response :authorization_error
|
||||
end
|
||||
|
||||
|
|
|
@ -15,7 +15,8 @@ class EppPollTest < EppTestCase
|
|||
</command>
|
||||
</epp>
|
||||
XML
|
||||
post epp_poll_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_poll_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
xml_doc = Nokogiri::XML(response.body)
|
||||
assert_epp_response :completed_successfully_ack_to_dequeue
|
||||
|
@ -36,7 +37,8 @@ class EppPollTest < EppTestCase
|
|||
</command>
|
||||
</epp>
|
||||
XML
|
||||
post epp_poll_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_poll_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
xml_doc = Nokogiri::XML(response.body)
|
||||
namespace = 'https://epp.tld.ee/schema/changePoll-1.0.xsd'
|
||||
|
@ -60,7 +62,8 @@ class EppPollTest < EppTestCase
|
|||
</command>
|
||||
</epp>
|
||||
XML
|
||||
post epp_poll_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_poll_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
assert_epp_response :completed_successfully_no_messages
|
||||
end
|
||||
|
@ -77,7 +80,8 @@ class EppPollTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
post epp_poll_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_poll_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
notification.reload
|
||||
|
||||
xml_doc = Nokogiri::XML(response.body)
|
||||
|
@ -98,7 +102,8 @@ class EppPollTest < EppTestCase
|
|||
</command>
|
||||
</epp>
|
||||
XML
|
||||
post epp_poll_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_poll_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
notification.reload
|
||||
|
||||
assert notification.unread?
|
||||
|
@ -114,7 +119,8 @@ class EppPollTest < EppTestCase
|
|||
</command>
|
||||
</epp>
|
||||
XML
|
||||
post epp_poll_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||
post epp_poll_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
assert_epp_response :object_does_not_exist
|
||||
end
|
||||
|
|
|
@ -6,9 +6,9 @@ class RegistrantAreaIdCardSignInTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_succeeds
|
||||
post_via_redirect registrant_id_card_sign_in_path, nil,
|
||||
'SSL_CLIENT_S_DN_CN' => 'DOE,JOHN,1234',
|
||||
'SSL_CLIENT_I_DN_C' => 'US'
|
||||
post registrant_id_card_sign_in_path, headers: { 'SSL_CLIENT_S_DN_CN' => 'DOE,JOHN,1234',
|
||||
'SSL_CLIENT_I_DN_C' => 'US' }
|
||||
follow_redirect!
|
||||
|
||||
assert_response :ok
|
||||
assert_equal registrant_root_path, path
|
||||
|
@ -16,7 +16,7 @@ class RegistrantAreaIdCardSignInTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_fails_when_certificate_is_absent
|
||||
post_via_redirect registrant_id_card_sign_in_path, nil, 'SSL_CLIENT_S_DN_CN' => ''
|
||||
post registrant_id_card_sign_in_path, headers: { 'SSL_CLIENT_S_DN_CN' => '' }
|
||||
|
||||
assert_response :ok
|
||||
assert_equal registrant_id_card_sign_in_path, path
|
||||
|
|
|
@ -13,7 +13,7 @@ class PaymentCallbackTest < ApplicationIntegrationTest
|
|||
assert_matching_bank_transaction_exists(invoice)
|
||||
|
||||
request_params = every_pay_request_params.merge(invoice_id: invoice.id)
|
||||
post "/registrar/pay/callback/every_pay", request_params
|
||||
post "/registrar/pay/callback/every_pay", params: request_params
|
||||
|
||||
assert_response :ok
|
||||
end
|
||||
|
|
|
@ -60,7 +60,7 @@ class PaymentReturnTest < ApplicationIntegrationTest
|
|||
def test_every_pay_return_creates_activity_redirects_to_invoice_path
|
||||
request_params = every_pay_request_params.merge(invoice_id: @invoice.id)
|
||||
|
||||
post "/registrar/pay/return/every_pay", request_params
|
||||
post "/registrar/pay/return/every_pay", params: request_params
|
||||
assert_equal(302, response.status)
|
||||
assert_redirected_to(registrar_invoice_path(@invoice))
|
||||
end
|
||||
|
@ -68,14 +68,14 @@ class PaymentReturnTest < ApplicationIntegrationTest
|
|||
def test_Every_Pay_return_raises_RecordNotFound
|
||||
request_params = every_pay_request_params.merge(invoice_id: "178907")
|
||||
assert_raises(ActiveRecord::RecordNotFound) do
|
||||
post "/registrar/pay/return/every_pay", request_params
|
||||
post "/registrar/pay/return/every_pay", params: request_params
|
||||
end
|
||||
end
|
||||
|
||||
def test_bank_link_return_redirects_to_invoice_paths
|
||||
request_params = bank_link_request_params.merge(invoice_id: @invoice.id)
|
||||
|
||||
post "/registrar/pay/return/seb", request_params
|
||||
post "/registrar/pay/return/seb", params: request_params
|
||||
assert_equal(302, response.status)
|
||||
assert_redirected_to(registrar_invoice_path(@invoice))
|
||||
end
|
||||
|
@ -83,7 +83,7 @@ class PaymentReturnTest < ApplicationIntegrationTest
|
|||
def test_bank_link_return
|
||||
request_params = bank_link_request_params.merge(invoice_id: "178907")
|
||||
assert_raises(ActiveRecord::RecordNotFound) do
|
||||
post "/registrar/pay/return/seb", request_params
|
||||
post "/registrar/pay/return/seb", params: request_params
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -13,8 +13,8 @@ class RegistrarAreaSettingsBalanceAutoReloadIntegrationTest < ActionDispatch::In
|
|||
threshold = 10
|
||||
assert_nil @registrar.settings['balance_auto_reload']
|
||||
|
||||
patch registrar_settings_balance_auto_reload_path, { type: { amount: amount,
|
||||
threshold: threshold } }
|
||||
patch registrar_settings_balance_auto_reload_path, params: { type: { amount: amount,
|
||||
threshold: threshold } }
|
||||
@registrar.reload
|
||||
|
||||
assert_equal amount, @registrar.settings['balance_auto_reload']['type']['amount']
|
||||
|
|
|
@ -13,7 +13,8 @@ class RegistrarAreaIdCardSignInTest < ApplicationIntegrationTest
|
|||
def test_signs_in_a_user_when_id_card_owner_is_found
|
||||
assert_equal '1234', @user.identity_code
|
||||
|
||||
post_via_redirect registrar_id_card_sign_in_path, nil, 'SSL_CLIENT_S_DN_CN' => 'DOE,JOHN,1234'
|
||||
post registrar_id_card_sign_in_path, headers: { 'SSL_CLIENT_S_DN_CN' => 'DOE,JOHN,1234' }
|
||||
follow_redirect!
|
||||
|
||||
assert_response :ok
|
||||
assert_equal registrar_root_path, path
|
||||
|
@ -21,8 +22,8 @@ class RegistrarAreaIdCardSignInTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_does_not_sign_in_a_user_when_id_card_owner_is_not_found
|
||||
post_via_redirect registrar_id_card_sign_in_path, nil,
|
||||
'SSL_CLIENT_S_DN_CN' => 'DOE,JOHN,unacceptable-personal-code'
|
||||
post registrar_id_card_sign_in_path,
|
||||
headers: { 'SSL_CLIENT_S_DN_CN' => 'DOE,JOHN,unacceptable-personal-code' }
|
||||
|
||||
assert_nil controller.current_registrar_user
|
||||
assert_equal registrar_id_card_sign_in_path, path
|
||||
|
@ -36,8 +37,8 @@ class RegistrarAreaIdCardSignInTest < ApplicationIntegrationTest
|
|||
|
||||
Setting.registrar_ip_whitelist_enabled = true
|
||||
|
||||
post registrar_id_card_sign_in_path, nil, 'SSL_CLIENT_S_DN_CN' => 'DOE,JOHN,1234',
|
||||
'REMOTE_ADDR' => '127.0.0.2'
|
||||
post registrar_id_card_sign_in_path, headers: { 'SSL_CLIENT_S_DN_CN' => 'DOE,JOHN,1234',
|
||||
'REMOTE_ADDR' => '127.0.0.2' }
|
||||
|
||||
assert_equal registrar_id_card_sign_in_path, path
|
||||
assert_equal 'Access denied from IP 127.0.0.2', response.body
|
||||
|
@ -47,7 +48,7 @@ class RegistrarAreaIdCardSignInTest < ApplicationIntegrationTest
|
|||
end
|
||||
|
||||
def test_does_not_sign_in_a_user_when_certificate_is_absent
|
||||
post_via_redirect registrar_id_card_sign_in_path, nil, 'SSL_CLIENT_S_DN_CN' => ''
|
||||
post registrar_id_card_sign_in_path, headers: { 'SSL_CLIENT_S_DN_CN' => '' }
|
||||
|
||||
assert_nil controller.current_registrar_user
|
||||
assert_equal registrar_id_card_sign_in_path, path
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue