Extract company register

Closes #1079, #916, #1077
This commit is contained in:
Artur Beljajev 2019-02-09 16:35:01 +02:00
parent 8c4e6f1656
commit 83f8a9fb6a
44 changed files with 530 additions and 610 deletions

View file

@ -1,7 +0,0 @@
one:
ident: 1234
ident_country_code: US
associated_businesses: []
retrieved_on: 2010-07-05 10:30
created_at: 2010-07-05 10:30
updated_at: 2010-07-05 10:30

View file

@ -5,33 +5,15 @@ class RegistrantApiContactsTest < ApplicationIntegrationTest
def setup
super
@original_registry_time = Setting.days_to_keep_business_registry_cache
Setting.days_to_keep_business_registry_cache = 1
travel_to Time.zone.parse('2010-07-05')
@contact = contacts(:john)
@user = users(:registrant)
@auth_headers = { 'HTTP_AUTHORIZATION' => auth_token }
end
def teardown
super
Setting.days_to_keep_business_registry_cache = @original_registry_time
travel_back
end
def test_root_returns_contact_list
get '/api/v1/registrant/contacts', {}, @auth_headers
assert_equal(200, response.status)
json_body = JSON.parse(response.body, symbolize_names: true)
assert_equal(4, json_body.count)
array_of_contact_codes = json_body.map { |x| x[:code] }
assert(array_of_contact_codes.include?('william-001'))
assert(array_of_contact_codes.include?('jane-001'))
end
def test_root_accepts_limit_and_offset_parameters
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
response_json = JSON.parse(response.body, symbolize_names: true)
assert_equal(200, response.status)
@ -39,26 +21,15 @@ class RegistrantApiContactsTest < ApplicationIntegrationTest
get '/api/v1/registrant/contacts', {}, @auth_headers
response_json = JSON.parse(response.body, symbolize_names: true)
assert_equal(4, response_json.count)
assert_equal(3, response_json.count)
end
def test_get_contact_details_by_uuid
get '/api/v1/registrant/contacts/0aa54704-d6f7-4ca9-b8ca-2827d9a4e4eb', {}, @auth_headers
assert_equal(200, response.status)
get api_v1_registrant_contact_path(@contact.uuid), nil, @auth_headers
contact = JSON.parse(response.body, symbolize_names: true)
assert_equal('william@inbox.test', contact[:email])
end
def test_root_returns_503_when_business_registry_is_not_available
raise_not_available = -> (a, b) { raise Soap::Arireg::NotAvailableError.new({}) }
BusinessRegistryCache.stub :fetch_by_ident_and_cc, raise_not_available do
get '/api/v1/registrant/contacts', {}, @auth_headers
assert_equal(503, response.status)
response_json = JSON.parse(response.body, symbolize_names: true)
assert_equal({ errors: [base: ['Business Registry not available']] }, response_json)
end
assert_response :ok
response_json = JSON.parse(response.body, symbolize_names: true)
assert_equal 'john@inbox.test', response_json[:email]
end
def test_get_contact_details_by_uuid_returns_404_for_non_existent_contact

View file

@ -5,23 +5,12 @@ class RegistrantApiDomainsTest < ApplicationIntegrationTest
def setup
super
@original_registry_time = Setting.days_to_keep_business_registry_cache
Setting.days_to_keep_business_registry_cache = 1
travel_to Time.zone.parse('2010-07-05')
@domain = domains(:hospital)
@registrant = @domain.registrant
@user = users(:registrant)
@auth_headers = { 'HTTP_AUTHORIZATION' => auth_token }
end
def teardown
super
Setting.days_to_keep_business_registry_cache = @original_registry_time
travel_back
end
def test_get_domain_details_by_uuid
get '/api/v1/registrant/domains/5edda1a5-3548-41ee-8b65-6d60daf85a37', {}, @auth_headers
assert_equal(200, response.status)

View file

@ -5,22 +5,11 @@ class RegistrantApiRegistryLocksTest < ApplicationIntegrationTest
def setup
super
@original_registry_time = Setting.days_to_keep_business_registry_cache
Setting.days_to_keep_business_registry_cache = 1
travel_to Time.zone.parse('2010-07-05')
@user = users(:registrant)
@domain = domains(:airport)
@auth_headers = { 'HTTP_AUTHORIZATION' => auth_token }
end
def teardown
super
Setting.days_to_keep_business_registry_cache = @original_registry_time
travel_back
end
def test_can_lock_a_not_locked_domain
post '/api/v1/registrant/domains/2df2c1a1-8f6a-490a-81be-8bdf29866880/registry_lock',
{}, @auth_headers
@ -101,11 +90,19 @@ class RegistrantApiRegistryLocksTest < ApplicationIntegrationTest
end
def test_technical_contact_cannot_lock_a_domain
post '/api/v1/registrant/domains/647bcc48-8d5e-4a04-8ce5-2a3cd17b6eab/registry_lock',
{}, @auth_headers
domain = domains(:shop)
contact = contacts(:john)
domain.update!(registrant: contacts(:william).becomes(Registrant))
domain.tech_contacts = [contact]
domain.admin_contacts.clear
assert_equal 'US-1234', @user.registrant_ident
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
assert_response :unauthorized
response_json = JSON.parse(response.body, symbolize_names: true)
assert_equal(401, response.status)
assert_equal({ errors: [{ base: ['Only administrative contacts can manage registry locks'] }] },
response_json)
end
@ -123,6 +120,7 @@ class RegistrantApiRegistryLocksTest < ApplicationIntegrationTest
end
def test_locking_domains_returns_serialized_domain_object
travel_to Time.zone.parse('2010-07-05')
assert_equal 'Best Names', @domain.registrar.name
assert_equal 'https://bestnames.test', @domain.registrar.website

View file

@ -0,0 +1,50 @@
require 'test_helper'
require 'auth_token/auth_token_creator'
CompanyRegisterClientStub = Struct.new(:any_method) do
def representation_rights(citizen_personal_code:, citizen_country_code:)
raise CompanyRegister::NotAvailableError
end
end
class RegistrantApiV1ContactDetailsTest < ActionDispatch::IntegrationTest
setup do
@contact = contacts(:john)
@user = users(:registrant)
end
def test_returns_direct_contact_when_company_register_is_unavailable
assert_equal '1234', @contact.ident
assert_equal Contact::PRIV, @contact.ident_type
assert_equal 'US', @contact.ident_country_code
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
end
response_json = JSON.parse(response.body, symbolize_names: true)
assert_equal '1234', response_json[:ident]
end
def test_unmanaged_contact_cannot_be_accessed
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
assert_response :not_found
response_json = JSON.parse(response.body, symbolize_names: true)
assert_equal ({ errors: [base: ['Contact not found']] }), response_json
end
private
def auth_token
token_creator = AuthTokenCreator.create_with_defaults(@user)
hash = token_creator.token_in_hash
"Bearer #{hash[:access_token]}"
end
end

View file

@ -0,0 +1,75 @@
require 'test_helper'
require 'auth_token/auth_token_creator'
CompanyRegisterClientStub = Struct.new(:any_method) do
def representation_rights(citizen_personal_code:, citizen_country_code:)
raise CompanyRegister::NotAvailableError
end
end
class RegistrantApiV1ContactListTest < ActionDispatch::IntegrationTest
setup do
@contact = contacts(:john)
@user = users(:registrant)
end
def test_returns_direct_contacts
delete_indirect_contact
assert_equal '1234', @contact.ident
assert_equal Contact::PRIV, @contact.ident_type
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
response_json = JSON.parse(response.body, symbolize_names: true)
assert_equal 1, response_json.size
assert_equal '1234', response_json.first[:ident][:code]
end
def test_returns_indirect_contacts
delete_direct_contact
@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
response_json = JSON.parse(response.body, symbolize_names: true)
assert_equal 1, response_json.size
assert_equal 'acme-ltd-001', response_json.first[:code]
end
def test_returns_direct_contacts_when_company_register_is_unavailable
assert_equal '1234', @contact.ident
assert_equal Contact::PRIV, @contact.ident_type
assert_equal 'US', @contact.ident_country_code
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
end
response_json = JSON.parse(response.body, symbolize_names: true)
assert_equal 1, response_json.size
assert_equal '1234', response_json.first[:ident][:code]
end
private
def delete_direct_contact
ActiveRecord::Base.connection.disable_referential_integrity { contacts(:john).delete }
end
def delete_indirect_contact
ActiveRecord::Base.connection.disable_referential_integrity { contacts(:acme_ltd).delete }
end
def auth_token
token_creator = AuthTokenCreator.create_with_defaults(@user)
hash = token_creator.token_in_hash
"Bearer #{hash[:access_token]}"
end
end

View file

@ -6,18 +6,13 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
@contact = contacts(:john)
@original_address_processing_setting = Setting.address_processing
@original_business_registry_cache_setting = Setting.days_to_keep_business_registry_cache
@original_fax_enabled_setting = ENV['fax_enabled']
@current_user = users(:registrant)
Setting.days_to_keep_business_registry_cache = 1
travel_to Time.zone.parse('2010-07-05')
@user = users(:registrant)
end
teardown do
Setting.address_processing = @original_address_processing_setting
Setting.days_to_keep_business_registry_cache = @original_business_registry_cache_setting
ENV['fax_enabled'] = @original_fax_enabled_setting
end
@ -52,8 +47,8 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
end
def test_update_fax_when_enabled
@contact.update!(fax: '+666.6')
ENV['fax_enabled'] = 'true'
@contact = contacts(:william)
patch api_v1_registrant_contact_path(@contact.uuid), { fax: '+777.7' }.to_json,
'HTTP_AUTHORIZATION' => auth_token,
@ -101,7 +96,7 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
end
def test_address_is_optional_when_enabled
@contact = contacts(:william)
@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,
@ -113,18 +108,18 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
end
def test_address_cannot_be_updated_when_disabled
@contact = contacts(:william)
@original_address = @contact.address
@contact.update!(street: 'old street')
Setting.address_processing = false
patch api_v1_registrant_contact_path(@contact.uuid), { address: { city: 'new city' } }.to_json,
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
@contact.reload
assert_response :bad_request
assert_equal @original_address, @contact.address
assert_not_equal 'new street', @contact.street
error_msg = 'Address processing is disabled and therefore cannot be updated'
assert_equal ({ errors: [{ address: [error_msg] }] }), JSON.parse(response.body,
@ -160,10 +155,15 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
end
def test_legal_persons_disclosed_attributes_cannot_be_changed
business_registry_caches(:one).update!(associated_businesses: %w[1234])
@contact.update!(ident_type: Contact::ORG,
ident: '1234',
disclosed_attributes: %w[])
@contact = contacts(:acme_ltd)
# contacts(:acme_ltd).ident
assert_equal '1234567', @contact.ident
assert_equal Contact::ORG, @contact.ident_type
assert_equal 'US', @contact.ident_country_code
@contact.update!(disclosed_attributes: %w[])
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] }
@ -222,7 +222,7 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
end
def test_unmanaged_contact_cannot_be_updated
@current_user.update!(registrant_ident: 'US-1234')
assert_equal 'US-1234', @user.registrant_ident
@contact.update!(ident: '12345')
patch api_v1_registrant_contact_path(@contact.uuid), { name: 'new name' }.to_json,
@ -252,7 +252,7 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
private
def auth_token
token_creator = AuthTokenCreator.create_with_defaults(@current_user)
token_creator = AuthTokenCreator.create_with_defaults(@user)
hash = token_creator.token_in_hash
"Bearer #{hash[:access_token]}"
end

View file

@ -9,6 +9,14 @@ class ContactTest < ActiveSupport::TestCase
assert @contact.valid?, proc { @contact.errors.full_messages }
end
def test_private_entity
assert_equal 'priv', Contact::PRIV
end
def test_legal_entity
assert_equal 'org', Contact::ORG
end
def test_invalid_without_email
@contact.email = ''
assert @contact.invalid?
@ -48,4 +56,27 @@ class ContactTest < ActiveSupport::TestCase
assert_equal 'EE', @contact.country_code
assert_equal address, @contact.address
end
end
def test_returns_registrant_user_direct_contacts
assert_equal Contact::PRIV, @contact.ident_type
assert_equal '1234', @contact.ident
assert_equal 'US', @contact.ident_country_code
registrant_user = RegistrantUser.new(registrant_ident: 'US-1234')
registrant_user.stub(:companies, []) do
assert_equal [@contact], Contact.registrant_user_contacts(registrant_user)
assert_equal [@contact], Contact.registrant_user_direct_contacts(registrant_user)
end
end
def test_returns_registrant_user_indirect_contacts
@contact.update!(ident_type: Contact::ORG)
assert_equal '1234', @contact.ident
assert_equal 'US', @contact.ident_country_code
registrant_user = RegistrantUser.new(registrant_ident: 'US-1234')
registrant_user.stub(:companies, [OpenStruct.new(registration_number: '1234')]) do
assert_equal [@contact], Contact.registrant_user_contacts(registrant_user)
end
end
end

View file

@ -17,4 +17,57 @@ class DomainTest < ActiveSupport::TestCase
domain = Domain.new(name: 'shop.test')
assert_equal 'shop.test', domain.domain_name.to_s
end
end
def test_returns_registrant_user_domains_by_registrant
registrant = contacts(:john).becomes(Registrant)
assert_equal registrant, @domain.registrant
registrant_user = RegistrantUser.new
registrant_user.stub(:contacts, [registrant]) do
assert_includes Domain.registrant_user_domains(registrant_user), @domain
end
end
def test_returns_registrant_user_domains_by_contact
contact = contacts(:jane)
assert_not_equal contact.becomes(Registrant), @domain.registrant
assert_includes @domain.contacts, contact
registrant_user = RegistrantUser.new
registrant_user.stub(:contacts, [contact]) do
assert_includes Domain.registrant_user_domains(registrant_user), @domain
end
end
def test_returns_registrant_user_administered_domains_by_registrant
registrant = contacts(:john).becomes(Registrant)
assert_equal registrant, @domain.registrant
registrant_user = RegistrantUser.new
registrant_user.stub(:contacts, [registrant]) do
assert_includes Domain.registrant_user_administered_domains(registrant_user), @domain
end
end
def test_returns_registrant_user_administered_domains_by_administrative_contact
contact = contacts(:jane)
assert_not_equal contact.becomes(Registrant), @domain.registrant
assert_includes @domain.admin_contacts, contact
registrant_user = RegistrantUser.new
registrant_user.stub(:contacts, [contact]) do
assert_includes Domain.registrant_user_administered_domains(registrant_user), @domain
end
end
def test_does_not_return_registrant_user_administered_domains_by_technical_contact
contact = contacts(:william)
assert_not_equal contact.becomes(Registrant), @domain.registrant
assert_includes @domain.tech_contacts, contact
registrant_user = RegistrantUser.new
registrant_user.stub(:contacts, [contact]) do
assert_not_includes Domain.registrant_user_administered_domains(registrant_user), @domain
end
end
end

View file

@ -11,29 +11,8 @@ class RegistrantUserTest < ActiveSupport::TestCase
super
end
def test_domains_returns_an_list_of_distinct_domains_associated_with_a_specific_id_code
domain_names = @user.domains.pluck(:name)
assert_equal(4, domain_names.length)
# User is a registrant, but not a contact for the domain. Should be included in the list.
assert(domain_names.include?('shop.test'))
end
def test_administered_domains_returns_a_list_of_domains
domain_names = @user.administered_domains.pluck(:name)
assert_equal(3, domain_names.length)
# User is a tech contact for the domain.
refute(domain_names.include?('library.test'))
end
def test_contacts_returns_an_list_of_contacts_associated_with_a_specific_id_code
assert_equal(1, @user.contacts.count)
end
def test_ident_and_country_code_helper_methods
def test_ident_helper_method
assert_equal('1234', @user.ident)
assert_equal('US', @user.country_code)
end
def test_first_name_from_username
@ -45,4 +24,44 @@ class RegistrantUserTest < ActiveSupport::TestCase
user = RegistrantUser.new(username: 'John Doe')
assert_equal 'Doe', user.last_name
end
end
def test_returns_country
user = RegistrantUser.new(registrant_ident: 'US-1234')
assert_equal Country.new('US'), user.country
end
def test_queries_company_register_for_associated_companies
assert_equal 'US-1234', @user.registrant_ident
company_register = Minitest::Mock.new
company_register.expect(:representation_rights, %w[acme ace], [{ citizen_personal_code: '1234',
citizen_country_code: 'USA' }])
assert_equal %w[acme ace], @user.companies(company_register)
company_register.verify
end
def test_returns_contacts
Contact.stub(:registrant_user_contacts, %w(john jane)) do
assert_equal %w(john jane), @user.contacts
end
end
def test_returns_direct_contacts
Contact.stub(:registrant_user_direct_contacts, %w(john jane)) do
assert_equal %w(john jane), @user.direct_contacts
end
end
def test_returns_domains
Domain.stub(:registrant_user_domains, %w(shop airport)) do
assert_equal %w(shop airport), @user.domains
end
end
def test_returns_administered_domains
Domain.stub(:registrant_user_administered_domains, %w(shop airport)) do
assert_equal %w(shop airport), @user.administered_domains
end
end
end

View file

@ -3,14 +3,12 @@ require 'test_helper'
class RegistrantAreaContactDetailsTest < ApplicationSystemTestCase
setup do
sign_in users(:registrant)
@domain = domains(:shop)
@contact = contacts(:john)
Setting.days_to_keep_business_registry_cache = 1
travel_to Time.zone.parse('2010-07-05')
end
def test_general_data
visit registrant_domain_contact_url(domains(:shop), @contact)
visit registrant_domain_contact_url(@domain, @contact)
assert_text 'Code john-001'
assert_text 'Name John'
@ -32,4 +30,12 @@ class RegistrantAreaContactDetailsTest < ApplicationSystemTestCase
assert_no_text 'Name John'
end
end
def test_unmanaged_contact_cannot_be_accessed
@contact.update!(ident: '12345')
assert_raises ActiveRecord::RecordNotFound do
visit registrant_domain_contact_url(@domain, @contact)
end
end
end

View file

@ -7,18 +7,14 @@ class RegistrantAreaContactUpdateTest < ApplicationIntegrationTest
sign_in users(:registrant)
@original_address_processing_setting = Setting.address_processing
@original_business_registry_cache_setting = Setting.days_to_keep_business_registry_cache
@original_fax_enabled_setting = ENV['fax_enabled']
@original_registrant_api_base_url_setting = ENV['registrant_api_base_url']
ENV['registrant_api_base_url'] = 'https://api.test'
Setting.days_to_keep_business_registry_cache = 1
travel_to Time.zone.parse('2010-07-05')
end
teardown do
Setting.address_processing = @original_address_processing_setting
Setting.days_to_keep_business_registry_cache = @original_business_registry_cache_setting
ENV['fax_enabled'] = @original_fax_enabled_setting
ENV['registrant_api_base_url'] = @original_registrant_api_base_url_setting
end
@ -90,7 +86,11 @@ class RegistrantAreaContactUpdateTest < ApplicationIntegrationTest
def test_form_is_pre_populated_with_address_when_enabled
Setting.address_processing = true
@contact = contacts(:william)
@contact.update!(street: 'Main Street',
zip: '12345',
city: 'New York',
state: 'New York State',
country_code: 'US')
visit edit_registrant_domain_contact_url(@domain, @contact)
@ -143,9 +143,10 @@ class RegistrantAreaContactUpdateTest < ApplicationIntegrationTest
def test_unmanaged_contact_cannot_be_updated
@contact.update!(ident: '12345')
visit registrant_domain_contact_url(@domain, @contact)
assert_no_button 'Edit'
assert_no_link 'Edit'
assert_raises ActiveRecord::RecordNotFound do
visit registrant_domain_contact_url(@domain, @contact)
end
end
def test_fail_gracefully

View file

@ -4,9 +4,6 @@ class RegistrantAreaDomainDetailsTest < ApplicationSystemTestCase
setup do
sign_in users(:registrant)
@domain = domains(:shop)
Setting.days_to_keep_business_registry_cache = 1
travel_to Time.zone.parse('2010-07-05')
end
def test_general_data

View file

@ -1,12 +1,17 @@
require 'test_helper'
CompanyRegisterClientStub = Struct.new(:any_method) do
def representation_rights(citizen_personal_code:, citizen_country_code:)
raise CompanyRegister::NotAvailableError
end
end
class RegistrantAreaDomainListTest < ApplicationSystemTestCase
setup do
sign_in users(:registrant)
@domain = domains(:shop)
@user = users(:registrant)
sign_in @user
Setting.days_to_keep_business_registry_cache = 1
travel_to Time.zone.parse('2010-07-05')
@domain = domains(:shop)
end
def test_show_domain_list
@ -22,4 +27,31 @@ class RegistrantAreaDomainListTest < ApplicationSystemTestCase
visit registrant_domains_url
assert_no_text 'metro.test'
end
def test_notification_when_company_register_is_unavailable
CompanyRegister::Client.stub(:new, CompanyRegisterClientStub.new) do
visit registrant_domains_url
end
assert_text 'Company register is unavailable. Domains and contacts associated via' \
' organizations are not shown.'
end
def test_show_direct_domains_when_company_register_is_unavailable
assert_equal 'US-1234', @user.registrant_ident
contact = contacts(:john)
assert_equal '1234', contact.ident
assert_equal Contact::PRIV, contact.ident_type
assert_equal 'US', contact.ident_country_code
assert_equal contact.becomes(Registrant), @domain.registrant
assert_equal 'shop.test', @domain.name
CompanyRegister::Client.stub(:new, CompanyRegisterClientStub.new) do
visit registrant_domains_url
end
assert_text 'shop.test'
end
end

View file

@ -3,9 +3,6 @@ require 'test_helper'
class RegistrantDomainsTest < ApplicationSystemTestCase
setup do
sign_in users(:registrant)
Setting.days_to_keep_business_registry_cache = 1
travel_to Time.zone.parse('2010-07-05')
end
def test_shows_domains_where_current_user_is_registrant

View file

@ -4,15 +4,6 @@ class RegistrantLayoutTest < ApplicationSystemTestCase
def setup
super
sign_in(users(:registrant))
Setting.days_to_keep_business_registry_cache = 1
travel_to Time.zone.parse('2010-07-05')
end
def teardown
super
travel_back
end
def test_has_link_to_rest_whois_and_internet_ee

View file

@ -16,6 +16,16 @@ require 'support/task_test_case'
Setting.address_processing = false
Setting.registry_country_code = 'US'
class CompanyRegisterClientStub
Company = Struct.new(:registration_number)
def representation_rights(citizen_personal_code:, citizen_country_code:)
[Company.new('1234567')]
end
end
CompanyRegister::Client = CompanyRegisterClientStub
class ActiveSupport::TestCase
include FactoryBot::Syntax::Methods