From 053382ffa35189be45fec4bcea0886c0a6313688 Mon Sep 17 00:00:00 2001 From: olegphenomenon Date: Mon, 10 Jan 2022 09:39:14 +0200 Subject: [PATCH] updated tests --- app/interactions/actions/domain_update.rb | 1 - .../registrant_api_verifications_test.rb | 1 - .../epp/domain/update/base_test.rb | 1 - .../epp/domain/update/rem_dns_test.rb | 1 - .../repp/v1/domains/contacts_test.rb | 1 - .../repp/v1/domains/dnssec_test.rb | 1 - .../repp/v1/domains/nameservers_test.rb | 1 - .../repp/v1/domains/update_test.rb | 1 - test/jobs/domain_update_confirm_job_test.rb | 1 - test/services/validate_dnssec_test.rb | 48 ------------------- 10 files changed, 57 deletions(-) delete mode 100644 test/services/validate_dnssec_test.rb diff --git a/app/interactions/actions/domain_update.rb b/app/interactions/actions/domain_update.rb index 2e44a015c..40b7876f6 100644 --- a/app/interactions/actions/domain_update.rb +++ b/app/interactions/actions/domain_update.rb @@ -14,7 +14,6 @@ module Actions assign_new_registrant if params[:registrant] assign_relational_modifications assign_requested_statuses - # ValidateDnssec.validate_dnssec(params: params, domain: domain) ::Actions::BaseAction.maybe_attach_legal_doc(domain, params[:legal_document]) commit diff --git a/test/integration/api/registrant/registrant_api_verifications_test.rb b/test/integration/api/registrant/registrant_api_verifications_test.rb index 8db49410f..612006eb9 100644 --- a/test/integration/api/registrant/registrant_api_verifications_test.rb +++ b/test/integration/api/registrant/registrant_api_verifications_test.rb @@ -15,7 +15,6 @@ class RegistrantApiVerificationsTest < ApplicationIntegrationTest @domain.update!(statuses: [DomainStatus::PENDING_UPDATE], registrant_verification_asked_at: Time.zone.now - 1.day, registrant_verification_token: @token) - Spy.on_instance_method(ValidateDnssec, :validate_dnssec).and_return(true) end def test_fetches_registrant_change_request diff --git a/test/integration/epp/domain/update/base_test.rb b/test/integration/epp/domain/update/base_test.rb index aaa7e1767..d021b496d 100644 --- a/test/integration/epp/domain/update/base_test.rb +++ b/test/integration/epp/domain/update/base_test.rb @@ -10,7 +10,6 @@ class EppDomainUpdateBaseTest < EppTestCase @original_registrant_change_verification = Setting.request_confirmation_on_registrant_change_enabled ActionMailer::Base.deliveries.clear - Spy.on_instance_method(ValidateDnssec, :validate_dnssec).and_return(true) end teardown do diff --git a/test/integration/epp/domain/update/rem_dns_test.rb b/test/integration/epp/domain/update/rem_dns_test.rb index ecd660fa6..6e079b126 100644 --- a/test/integration/epp/domain/update/rem_dns_test.rb +++ b/test/integration/epp/domain/update/rem_dns_test.rb @@ -12,7 +12,6 @@ class EppDomainUpdateRemDnsTest < EppTestCase @original_registrant_change_verification = Setting.request_confirmation_on_registrant_change_enabled ActionMailer::Base.deliveries.clear - Spy.on_instance_method(ValidateDnssec, :validate_dnssec).and_return(true) end teardown do diff --git a/test/integration/repp/v1/domains/contacts_test.rb b/test/integration/repp/v1/domains/contacts_test.rb index 540514853..b9b26a745 100644 --- a/test/integration/repp/v1/domains/contacts_test.rb +++ b/test/integration/repp/v1/domains/contacts_test.rb @@ -8,7 +8,6 @@ class ReppV1DomainsContactsTest < ActionDispatch::IntegrationTest token = "Basic #{token}" @auth_headers = { 'Authorization' => token } - Spy.on_instance_method(ValidateDnssec, :validate_dnssec).and_return(true) end def test_shows_existing_domain_contacts diff --git a/test/integration/repp/v1/domains/dnssec_test.rb b/test/integration/repp/v1/domains/dnssec_test.rb index 79480c3b8..6835e2600 100644 --- a/test/integration/repp/v1/domains/dnssec_test.rb +++ b/test/integration/repp/v1/domains/dnssec_test.rb @@ -8,7 +8,6 @@ class ReppV1DomainsDnssecTest < ActionDispatch::IntegrationTest token = "Basic #{token}" @auth_headers = { 'Authorization' => token } - Spy.on_instance_method(ValidateDnssec, :validate_dnssec).and_return(true) end def test_shows_dnssec_keys_associated_with_domain diff --git a/test/integration/repp/v1/domains/nameservers_test.rb b/test/integration/repp/v1/domains/nameservers_test.rb index 4c7a1dcc5..780e889c1 100644 --- a/test/integration/repp/v1/domains/nameservers_test.rb +++ b/test/integration/repp/v1/domains/nameservers_test.rb @@ -8,7 +8,6 @@ class ReppV1DomainsNameserversTest < ActionDispatch::IntegrationTest token = "Basic #{token}" @auth_headers = { 'Authorization' => token } - Spy.on_instance_method(ValidateDnssec, :validate_dnssec).and_return(true) end def test_can_add_new_nameserver diff --git a/test/integration/repp/v1/domains/update_test.rb b/test/integration/repp/v1/domains/update_test.rb index 595d094fe..d924fe7a3 100644 --- a/test/integration/repp/v1/domains/update_test.rb +++ b/test/integration/repp/v1/domains/update_test.rb @@ -8,7 +8,6 @@ class ReppV1DomainsUpdateTest < ActionDispatch::IntegrationTest token = "Basic #{token}" @auth_headers = { 'Authorization' => token } - Spy.on_instance_method(ValidateDnssec, :validate_dnssec).and_return(true) end def test_updates_transfer_code_for_domain diff --git a/test/jobs/domain_update_confirm_job_test.rb b/test/jobs/domain_update_confirm_job_test.rb index a5999cd36..158729ae3 100644 --- a/test/jobs/domain_update_confirm_job_test.rb +++ b/test/jobs/domain_update_confirm_job_test.rb @@ -14,7 +14,6 @@ class DomainUpdateConfirmJobTest < ActiveSupport::TestCase new_registrant_name: @new_registrant.name, new_registrant_email: @new_registrant.email, current_user_id: @user.id }) - Spy.on_instance_method(ValidateDnssec, :validate_dnssec).and_return(true) end def teardown diff --git a/test/services/validate_dnssec_test.rb b/test/services/validate_dnssec_test.rb deleted file mode 100644 index b3e939ee4..000000000 --- a/test/services/validate_dnssec_test.rb +++ /dev/null @@ -1,48 +0,0 @@ -require 'test_helper' - -class ValidateDnssecTest < ActiveSupport::TestCase - setup do - @dnskey = dnskeys(:one) - @domain = domains(:shop) - - @result_container = [{ - basic: { - flags: @dnskey.flags.to_s, - algorithm: @dnskey.alg.to_s, - protocol: @dnskey.protocol.to_s, - }, - public_key: @dnskey.public_key.to_s - }] - - Spy.on_instance_method(ValidateDnssec, :validation_dns_key_error).and_return(false) - end - - def test_should_return_true_if_dnssec_data_are_matches - Spy.on_instance_method(ValidateDnssec, :get_dnskey_records_from_subzone).and_return(@result_container) - match_params = build_params(@dnskey.flags) - validate_result = ValidateDnssec.validate_dnssec(params: match_params, domain: @domain) - - assert validate_result - end - - def test_should_return_false_if_dnssec_data_does_not_matcher - Spy.on_instance_method(ValidateDnssec, :get_dnskey_records_from_subzone).and_return(@result_container) - match_params = build_params(256) - validate_result = ValidateDnssec.validate_dnssec(params: match_params, domain: @domain) - - refute validate_result - end - - def build_params(flag) - { - action: "add", - domain: @domain, - dns_keys: [{ - flags: flag, - alg: @dnskey.alg, - protocol: @dnskey.protocol, - public_key: @dnskey.public_key - }] - } - end -end