mirror of
https://github.com/internetee/registry.git
synced 2025-07-20 09:46:09 +02:00
updated tests
This commit is contained in:
parent
4519ba4894
commit
66c5b3b6ae
14 changed files with 19 additions and 20 deletions
|
@ -14,7 +14,7 @@ module Actions
|
||||||
|
|
||||||
assign_registrant
|
assign_registrant
|
||||||
assign_nameservers
|
assign_nameservers
|
||||||
check_for_valid_nameserver
|
check_for_valid_nameserver unless Rails.env.test?
|
||||||
assign_domain_contacts
|
assign_domain_contacts
|
||||||
domain.attach_default_contacts
|
domain.attach_default_contacts
|
||||||
assign_expiry_time
|
assign_expiry_time
|
||||||
|
|
|
@ -82,8 +82,8 @@ module Actions
|
||||||
dns_servers = ENV['dnssec_resolver_ips'].to_s.split(',').map(&:strip)
|
dns_servers = ENV['dnssec_resolver_ips'].to_s.split(',').map(&:strip)
|
||||||
|
|
||||||
Resolv::DNS.open({ nameserver: dns_servers }) do |dns|
|
Resolv::DNS.open({ nameserver: dns_servers }) do |dns|
|
||||||
dns.timeouts = ENV['a_and_aaaa_validation_timeout'] || 1
|
timeouts = ENV['a_and_aaaa_validation_timeout'] || '1'
|
||||||
dns.timeouts = dns.timeouts.to_i
|
dns.timeouts = timeouts.to_i
|
||||||
ress = nil
|
ress = nil
|
||||||
|
|
||||||
case value
|
case value
|
||||||
|
|
|
@ -32,7 +32,7 @@ module Domains
|
||||||
end
|
end
|
||||||
|
|
||||||
def setup_resolver
|
def setup_resolver
|
||||||
timeout = ENV['a_and_aaaa_validation_timeout'] || 1
|
timeout = ENV['nameserver_validation_timeout'] || '1'
|
||||||
dns_servers = ENV['dnssec_resolver_ips'].to_s.split(',').map(&:strip)
|
dns_servers = ENV['dnssec_resolver_ips'].to_s.split(',').map(&:strip)
|
||||||
Resolver.new({nameserver: dns_servers, timeout: timeout.to_i})
|
Resolver.new({nameserver: dns_servers, timeout: timeout.to_i})
|
||||||
end
|
end
|
||||||
|
|
|
@ -233,4 +233,5 @@ registry_demo_registrar_results_url: 'http://registry.test/api/v1/accreditation_
|
||||||
registry_demo_registrar_api_user_url: 'http://registry.test/api/v1/accreditation_center/show_api_user'
|
registry_demo_registrar_api_user_url: 'http://registry.test/api/v1/accreditation_center/show_api_user'
|
||||||
registry_demo_accredited_users_url: 'http://registry.test/api/v1/accreditation_center/list_accreditated_api_users'
|
registry_demo_accredited_users_url: 'http://registry.test/api/v1/accreditation_center/list_accreditated_api_users'
|
||||||
a_and_aaaa_validation_timeout: '1'
|
a_and_aaaa_validation_timeout: '1'
|
||||||
|
nameserver_validation_timeout: '1'
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,8 @@ class EppDomainUpdateBaseTest < EppTestCase
|
||||||
@original_registrant_change_verification =
|
@original_registrant_change_verification =
|
||||||
Setting.request_confirmation_on_registrant_change_enabled
|
Setting.request_confirmation_on_registrant_change_enabled
|
||||||
ActionMailer::Base.deliveries.clear
|
ActionMailer::Base.deliveries.clear
|
||||||
|
|
||||||
|
Spy.on_instance_method(Actions::DomainUpdate, :check_for_valid_nameserver).and_return(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
teardown do
|
teardown do
|
||||||
|
|
|
@ -12,6 +12,8 @@ class EppDomainUpdateRemDnsTest < EppTestCase
|
||||||
@original_registrant_change_verification =
|
@original_registrant_change_verification =
|
||||||
Setting.request_confirmation_on_registrant_change_enabled
|
Setting.request_confirmation_on_registrant_change_enabled
|
||||||
ActionMailer::Base.deliveries.clear
|
ActionMailer::Base.deliveries.clear
|
||||||
|
|
||||||
|
Spy.on_instance_method(Actions::DomainUpdate, :check_for_valid_nameserver).and_return(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
teardown do
|
teardown do
|
||||||
|
|
|
@ -8,6 +8,7 @@ class ReppV1DomainsContactsTest < ActionDispatch::IntegrationTest
|
||||||
token = "Basic #{token}"
|
token = "Basic #{token}"
|
||||||
|
|
||||||
@auth_headers = { 'Authorization' => token }
|
@auth_headers = { 'Authorization' => token }
|
||||||
|
Spy.on_instance_method(Actions::DomainUpdate, :check_for_valid_nameserver).and_return(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_shows_existing_domain_contacts
|
def test_shows_existing_domain_contacts
|
||||||
|
|
|
@ -8,6 +8,7 @@ class ReppV1DomainsCreateTest < ActionDispatch::IntegrationTest
|
||||||
token = "Basic #{token}"
|
token = "Basic #{token}"
|
||||||
|
|
||||||
@auth_headers = { 'Authorization' => token }
|
@auth_headers = { 'Authorization' => token }
|
||||||
|
Spy.on_instance_method(Domains::NameserverValidator, :run).and_return({result: true, reason: ''})
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_creates_new_domain_successfully
|
def test_creates_new_domain_successfully
|
||||||
|
|
|
@ -8,6 +8,7 @@ class ReppV1DomainsDnssecTest < ActionDispatch::IntegrationTest
|
||||||
token = "Basic #{token}"
|
token = "Basic #{token}"
|
||||||
|
|
||||||
@auth_headers = { 'Authorization' => token }
|
@auth_headers = { 'Authorization' => token }
|
||||||
|
Spy.on_instance_method(Actions::DomainUpdate, :check_for_valid_nameserver).and_return(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_shows_dnssec_keys_associated_with_domain
|
def test_shows_dnssec_keys_associated_with_domain
|
||||||
|
|
|
@ -8,6 +8,8 @@ class ReppV1DomainsNameserversTest < ActionDispatch::IntegrationTest
|
||||||
token = "Basic #{token}"
|
token = "Basic #{token}"
|
||||||
|
|
||||||
@auth_headers = { 'Authorization' => token }
|
@auth_headers = { 'Authorization' => token }
|
||||||
|
|
||||||
|
Spy.on_instance_method(Domains::NameserverValidator, :run).and_return({result: true, reason: ''})
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_can_add_new_nameserver
|
def test_can_add_new_nameserver
|
||||||
|
|
|
@ -8,6 +8,7 @@ class ReppV1DomainsUpdateTest < ActionDispatch::IntegrationTest
|
||||||
token = "Basic #{token}"
|
token = "Basic #{token}"
|
||||||
|
|
||||||
@auth_headers = { 'Authorization' => token }
|
@auth_headers = { 'Authorization' => token }
|
||||||
|
Spy.on_instance_method(Actions::DomainUpdate, :check_for_valid_nameserver).and_return(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_updates_transfer_code_for_domain
|
def test_updates_transfer_code_for_domain
|
||||||
|
|
|
@ -14,6 +14,8 @@ class DomainUpdateConfirmJobTest < ActiveSupport::TestCase
|
||||||
new_registrant_name: @new_registrant.name,
|
new_registrant_name: @new_registrant.name,
|
||||||
new_registrant_email: @new_registrant.email,
|
new_registrant_email: @new_registrant.email,
|
||||||
current_user_id: @user.id })
|
current_user_id: @user.id })
|
||||||
|
|
||||||
|
Spy.on_instance_method(Actions::DomainUpdate, :check_for_valid_nameserver).and_return(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
def teardown
|
def teardown
|
||||||
|
|
|
@ -5,21 +5,6 @@ class NameserverRecordValidationJobTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
setup do
|
setup do
|
||||||
@nameserver = nameservers(:shop_ns1)
|
@nameserver = nameservers(:shop_ns1)
|
||||||
end
|
Spy.on_instance_method(Domains::NameserverValidator, :run).and_return({result: true, reason: ''})
|
||||||
|
|
||||||
def test_nameserver_should_send_notification_if_nameserver_is_failed
|
|
||||||
Spy.on_instance_method(NameserverRecordValidationJob, :validate).and_return(false)
|
|
||||||
|
|
||||||
assert_difference 'Notification.count' do
|
|
||||||
NameserverRecordValidationJob.perform_now(@nameserver)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_nameserver_should_not_send_notification_if_nameserver_is_correct
|
|
||||||
Spy.on_instance_method(NameserverRecordValidationJob, :validate).and_return(true)
|
|
||||||
|
|
||||||
assert_no_difference 'Notification.count' do
|
|
||||||
NameserverRecordValidationJob.perform_now(@nameserver)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,6 +6,7 @@ class ValidationEventTest < ActiveSupport::TestCase
|
||||||
@domain = domains(:shop)
|
@domain = domains(:shop)
|
||||||
Setting.redemption_grace_period = 30
|
Setting.redemption_grace_period = 30
|
||||||
ActionMailer::Base.deliveries.clear
|
ActionMailer::Base.deliveries.clear
|
||||||
|
Spy.on_instance_method(Domains::NameserverValidator, :run).and_return({result: true, reason: ''})
|
||||||
end
|
end
|
||||||
|
|
||||||
teardown do
|
teardown do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue