mirror of
https://github.com/internetee/registry.git
synced 2025-06-08 05:34:46 +02:00
parent
8c4e6f1656
commit
83f8a9fb6a
44 changed files with 530 additions and 610 deletions
|
@ -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
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue