mirror of
https://github.com/internetee/registry.git
synced 2025-06-06 20:55:44 +02:00
Clean up settings after tests
This commit is contained in:
parent
840f1db5c9
commit
7fcab05e51
15 changed files with 74 additions and 22 deletions
|
@ -4,9 +4,14 @@ class APIDomainTransfersTest < ApplicationIntegrationTest
|
||||||
setup do
|
setup do
|
||||||
@domain = domains(:shop)
|
@domain = domains(:shop)
|
||||||
@new_registrar = registrars(:goodnames)
|
@new_registrar = registrars(:goodnames)
|
||||||
|
@original_transfer_wait_time = Setting.transfer_wait_time
|
||||||
Setting.transfer_wait_time = 0 # Auto-approval
|
Setting.transfer_wait_time = 0 # Auto-approval
|
||||||
end
|
end
|
||||||
|
|
||||||
|
teardown do
|
||||||
|
Setting.transfer_wait_time = @original_transfer_wait_time
|
||||||
|
end
|
||||||
|
|
||||||
def test_returns_domain_transfers
|
def test_returns_domain_transfers
|
||||||
post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||||
assert_response 200
|
assert_response 200
|
||||||
|
|
|
@ -5,14 +5,14 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
|
||||||
setup do
|
setup do
|
||||||
@contact = contacts(:john)
|
@contact = contacts(:john)
|
||||||
|
|
||||||
@original_address_processing_setting = Setting.address_processing
|
@original_address_processing = Setting.address_processing
|
||||||
@original_fax_enabled_setting = ENV['fax_enabled']
|
@original_fax_enabled_setting = ENV['fax_enabled']
|
||||||
|
|
||||||
@user = users(:registrant)
|
@user = users(:registrant)
|
||||||
end
|
end
|
||||||
|
|
||||||
teardown do
|
teardown do
|
||||||
Setting.address_processing = @original_address_processing_setting
|
Setting.address_processing = @original_address_processing
|
||||||
ENV['fax_enabled'] = @original_fax_enabled_setting
|
ENV['fax_enabled'] = @original_fax_enabled_setting
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -5,12 +5,12 @@ class EppDomainDeleteBaseTest < EppTestCase
|
||||||
|
|
||||||
setup do
|
setup do
|
||||||
@domain = domains(:shop)
|
@domain = domains(:shop)
|
||||||
@original_confirmation_setting = Setting.request_confirmation_on_domain_deletion_enabled
|
@original_domain_delete_confirmation = Setting.request_confirmation_on_domain_deletion_enabled
|
||||||
ActionMailer::Base.deliveries.clear
|
ActionMailer::Base.deliveries.clear
|
||||||
end
|
end
|
||||||
|
|
||||||
teardown do
|
teardown do
|
||||||
Setting.request_confirmation_on_domain_deletion_enabled = @original_confirmation_setting
|
Setting.request_confirmation_on_domain_deletion_enabled = @original_domain_delete_confirmation
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_bypasses_domain_and_registrant_and_contacts_validation
|
def test_bypasses_domain_and_registrant_and_contacts_validation
|
||||||
|
|
|
@ -3,11 +3,18 @@ require 'test_helper'
|
||||||
class EppDomainUpdateBaseTest < EppTestCase
|
class EppDomainUpdateBaseTest < EppTestCase
|
||||||
include ActionMailer::TestHelper
|
include ActionMailer::TestHelper
|
||||||
|
|
||||||
def setup
|
setup do
|
||||||
@domain = domains(:shop)
|
@domain = domains(:shop)
|
||||||
|
@original_registrant_change_verification =
|
||||||
|
Setting.request_confrimation_on_registrant_change_enabled
|
||||||
ActionMailer::Base.deliveries.clear
|
ActionMailer::Base.deliveries.clear
|
||||||
end
|
end
|
||||||
|
|
||||||
|
teardown do
|
||||||
|
Setting.request_confrimation_on_registrant_change_enabled =
|
||||||
|
@original_registrant_change_verification
|
||||||
|
end
|
||||||
|
|
||||||
def test_update_domain
|
def test_update_domain
|
||||||
request_xml = <<-XML
|
request_xml = <<-XML
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
|
|
@ -3,6 +3,11 @@ require 'test_helper'
|
||||||
class RegistrarAreaIdCardSignInTest < ApplicationIntegrationTest
|
class RegistrarAreaIdCardSignInTest < ApplicationIntegrationTest
|
||||||
setup do
|
setup do
|
||||||
@user = users(:api_bestnames)
|
@user = users(:api_bestnames)
|
||||||
|
@original_registrar_area_ip_whitelist = Setting.registrar_ip_whitelist_enabled
|
||||||
|
end
|
||||||
|
|
||||||
|
teardown do
|
||||||
|
Setting.registrar_ip_whitelist_enabled = @original_registrar_area_ip_whitelist
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_signs_in_a_user_when_id_card_owner_is_found
|
def test_signs_in_a_user_when_id_card_owner_is_found
|
||||||
|
@ -39,8 +44,6 @@ class RegistrarAreaIdCardSignInTest < ApplicationIntegrationTest
|
||||||
|
|
||||||
get registrar_root_path
|
get registrar_root_path
|
||||||
assert_redirected_to new_registrar_user_session_path
|
assert_redirected_to new_registrar_user_session_path
|
||||||
|
|
||||||
Setting.registrar_ip_whitelist_enabled = false
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_does_not_sign_in_a_user_when_certificate_is_absent
|
def test_does_not_sign_in_a_user_when_certificate_is_absent
|
||||||
|
|
|
@ -5,14 +5,12 @@ class DepositTest < ActiveSupport::TestCase
|
||||||
super
|
super
|
||||||
|
|
||||||
@deposit = Deposit.new(registrar: registrars(:bestnames))
|
@deposit = Deposit.new(registrar: registrars(:bestnames))
|
||||||
@minimum_deposit = Setting.minimum_deposit
|
@original_minimum_deposit = Setting.minimum_deposit
|
||||||
Setting.minimum_deposit = 1.00
|
Setting.minimum_deposit = 1.00
|
||||||
end
|
end
|
||||||
|
|
||||||
def teardown
|
teardown do
|
||||||
super
|
Setting.minimum_deposit = @original_minimum_deposit
|
||||||
|
|
||||||
Setting.minimum_deposit = @minimum_deposit
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_validate_amount_cannot_be_lower_than_0_01
|
def test_validate_amount_cannot_be_lower_than_0_01
|
||||||
|
|
|
@ -5,9 +5,14 @@ class DomainCronTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
setup do
|
setup do
|
||||||
@domain = domains(:shop)
|
@domain = domains(:shop)
|
||||||
|
@original_expire_pending_confirmation = Setting.expire_pending_confirmation
|
||||||
ActionMailer::Base.deliveries.clear
|
ActionMailer::Base.deliveries.clear
|
||||||
end
|
end
|
||||||
|
|
||||||
|
teardown do
|
||||||
|
Setting.expire_pending_confirmation = @original_expire_pending_confirmation
|
||||||
|
end
|
||||||
|
|
||||||
def test_clean_expired_pendings_notifies_registrant_by_email
|
def test_clean_expired_pendings_notifies_registrant_by_email
|
||||||
Setting.expire_pending_confirmation = 0
|
Setting.expire_pending_confirmation = 0
|
||||||
@domain.update!(registrant_verification_asked_at: Time.zone.now,
|
@domain.update!(registrant_verification_asked_at: Time.zone.now,
|
||||||
|
|
|
@ -3,6 +3,13 @@ require 'test_helper'
|
||||||
class RegistrarTest < ActiveSupport::TestCase
|
class RegistrarTest < ActiveSupport::TestCase
|
||||||
setup do
|
setup do
|
||||||
@registrar = registrars(:bestnames)
|
@registrar = registrars(:bestnames)
|
||||||
|
@original_default_language = Setting.default_language
|
||||||
|
@original_days_to_keep_invoices_active = Setting.days_to_keep_invoices_active
|
||||||
|
end
|
||||||
|
|
||||||
|
teardown do
|
||||||
|
Setting.default_language = @original_default_language
|
||||||
|
Setting.days_to_keep_invoices_active = @original_days_to_keep_invoices_active
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_valid_registrar_is_valid
|
def test_valid_registrar_is_valid
|
||||||
|
@ -120,15 +127,12 @@ class RegistrarTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
def test_issues_new_invoice
|
def test_issues_new_invoice
|
||||||
travel_to Time.zone.parse('2010-07-05')
|
travel_to Time.zone.parse('2010-07-05')
|
||||||
@original_days_to_keep_invoices_active_setting = Setting.days_to_keep_invoices_active
|
|
||||||
Setting.days_to_keep_invoices_active = 10
|
Setting.days_to_keep_invoices_active = 10
|
||||||
|
|
||||||
invoice = @registrar.issue_prepayment_invoice(100)
|
invoice = @registrar.issue_prepayment_invoice(100)
|
||||||
|
|
||||||
assert_equal Date.parse('2010-07-05'), invoice.issue_date
|
assert_equal Date.parse('2010-07-05'), invoice.issue_date
|
||||||
assert_equal Date.parse('2010-07-15'), invoice.due_date
|
assert_equal Date.parse('2010-07-15'), invoice.due_date
|
||||||
|
|
||||||
Setting.days_to_keep_invoices_active = @original_days_to_keep_invoices_active_setting
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_issues_e_invoice_along_with_invoice
|
def test_issues_e_invoice_along_with_invoice
|
||||||
|
|
|
@ -1,6 +1,16 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class RegistryTest < ActiveSupport::TestCase
|
class RegistryTest < ActiveSupport::TestCase
|
||||||
|
setup do
|
||||||
|
@original_registry_vat_rate = Setting.registry_vat_prc
|
||||||
|
@original_registry_country_code = Setting.registry_country_code
|
||||||
|
end
|
||||||
|
|
||||||
|
teardown do
|
||||||
|
Setting.registry_vat_prc = @original_registry_vat_rate
|
||||||
|
Setting.registry_country_code = @original_registry_country_code
|
||||||
|
end
|
||||||
|
|
||||||
def test_returns_current_registry
|
def test_returns_current_registry
|
||||||
Setting.registry_vat_prc = 0.2
|
Setting.registry_vat_prc = 0.2
|
||||||
Setting.registry_country_code = 'US'
|
Setting.registry_country_code = 'US'
|
||||||
|
|
|
@ -7,12 +7,12 @@ class Whois::RecordTest < ActiveSupport::TestCase
|
||||||
@whois_record = whois_records(:one)
|
@whois_record = whois_records(:one)
|
||||||
@auction = auctions(:one)
|
@auction = auctions(:one)
|
||||||
|
|
||||||
@original_disclaimer_setting = Setting.registry_whois_disclaimer
|
@original_disclaimer = Setting.registry_whois_disclaimer
|
||||||
Setting.registry_whois_disclaimer = 'disclaimer'
|
Setting.registry_whois_disclaimer = 'disclaimer'
|
||||||
end
|
end
|
||||||
|
|
||||||
teardown do
|
teardown do
|
||||||
Setting.registry_whois_disclaimer = @original_disclaimer_setting
|
Setting.registry_whois_disclaimer = @original_disclaimer
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_reads_disclaimer_setting
|
def test_reads_disclaimer_setting
|
||||||
|
|
|
@ -3,6 +3,11 @@ require 'test_helper'
|
||||||
class OverdueInvoiceCancellerTest < ActiveSupport::TestCase
|
class OverdueInvoiceCancellerTest < ActiveSupport::TestCase
|
||||||
setup do
|
setup do
|
||||||
@invoice = invoices(:one)
|
@invoice = invoices(:one)
|
||||||
|
@original_days_to_keep_overdue_invoices_active = Setting.days_to_keep_overdue_invoices_active
|
||||||
|
end
|
||||||
|
|
||||||
|
teardown do
|
||||||
|
Setting.days_to_keep_overdue_invoices_active = @original_days_to_keep_overdue_invoices_active
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_default_delay
|
def test_default_delay
|
||||||
|
|
|
@ -5,9 +5,14 @@ class AdminRegistrarsSystemTest < ApplicationSystemTestCase
|
||||||
|
|
||||||
setup do
|
setup do
|
||||||
@registrar = registrars(:bestnames)
|
@registrar = registrars(:bestnames)
|
||||||
|
@original_default_language = Setting.default_language
|
||||||
sign_in users(:admin)
|
sign_in users(:admin)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
teardown do
|
||||||
|
Setting.default_language = @original_default_language
|
||||||
|
end
|
||||||
|
|
||||||
def test_creates_new_registrar
|
def test_creates_new_registrar
|
||||||
assert_nil Registrar.find_by(name: 'Acme Ltd')
|
assert_nil Registrar.find_by(name: 'Acme Ltd')
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ class RegistrantAreaContactUpdateTest < ApplicationIntegrationTest
|
||||||
@contact = contacts(:john)
|
@contact = contacts(:john)
|
||||||
sign_in users(:registrant)
|
sign_in users(:registrant)
|
||||||
|
|
||||||
@original_address_processing_setting = Setting.address_processing
|
@original_address_processing = Setting.address_processing
|
||||||
@original_fax_enabled_setting = ENV['fax_enabled']
|
@original_fax_enabled_setting = ENV['fax_enabled']
|
||||||
@original_registrant_api_base_url_setting = ENV['registrant_api_base_url']
|
@original_registrant_api_base_url_setting = ENV['registrant_api_base_url']
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ class RegistrantAreaContactUpdateTest < ApplicationIntegrationTest
|
||||||
end
|
end
|
||||||
|
|
||||||
teardown do
|
teardown do
|
||||||
Setting.address_processing = @original_address_processing_setting
|
Setting.address_processing = @original_address_processing
|
||||||
ENV['fax_enabled'] = @original_fax_enabled_setting
|
ENV['fax_enabled'] = @original_fax_enabled_setting
|
||||||
ENV['registrant_api_base_url'] = @original_registrant_api_base_url_setting
|
ENV['registrant_api_base_url'] = @original_registrant_api_base_url_setting
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,14 @@
|
||||||
require 'application_system_test_case'
|
require 'application_system_test_case'
|
||||||
|
|
||||||
class RegistrarAreaBaseTestTest < ApplicationSystemTestCase
|
class RegistrarAreaBaseTestTest < ApplicationSystemTestCase
|
||||||
|
setup do
|
||||||
|
@original_registrar_area_ip_whitelist = Setting.registrar_ip_whitelist_enabled
|
||||||
|
end
|
||||||
|
|
||||||
|
teardown do
|
||||||
|
Setting.registrar_ip_whitelist_enabled = @original_registrar_area_ip_whitelist
|
||||||
|
end
|
||||||
|
|
||||||
def test_user_cannot_access_without_ip_address_being_whitelisted
|
def test_user_cannot_access_without_ip_address_being_whitelisted
|
||||||
Setting.registrar_ip_whitelist_enabled = true
|
Setting.registrar_ip_whitelist_enabled = true
|
||||||
WhiteIp.delete_all
|
WhiteIp.delete_all
|
||||||
|
|
|
@ -3,10 +3,14 @@ require 'application_system_test_case'
|
||||||
class BalanceTopUpTest < ApplicationSystemTestCase
|
class BalanceTopUpTest < ApplicationSystemTestCase
|
||||||
setup do
|
setup do
|
||||||
sign_in users(:api_bestnames)
|
sign_in users(:api_bestnames)
|
||||||
|
@original_registry_vat_rate = Setting.registry_vat_prc
|
||||||
|
end
|
||||||
|
|
||||||
|
teardown do
|
||||||
|
Setting.registry_vat_prc = @original_registry_vat_rate
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_creates_new_invoice
|
def test_creates_new_invoice
|
||||||
original_vat_prc = Setting.registry_vat_prc
|
|
||||||
Setting.registry_vat_prc = 0.1
|
Setting.registry_vat_prc = 0.1
|
||||||
|
|
||||||
visit registrar_invoices_url
|
visit registrar_invoices_url
|
||||||
|
@ -22,7 +26,5 @@ class BalanceTopUpTest < ApplicationSystemTestCase
|
||||||
assert_equal BigDecimal(10), invoice.vat_rate
|
assert_equal BigDecimal(10), invoice.vat_rate
|
||||||
assert_equal BigDecimal('28.05'), invoice.total
|
assert_equal BigDecimal('28.05'), invoice.total
|
||||||
assert_text 'Please pay the following invoice'
|
assert_text 'Please pay the following invoice'
|
||||||
|
|
||||||
Setting.registry_vat_prc = original_vat_prc
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue