From d9f627425800e02e2f68d105f445974993e74243 Mon Sep 17 00:00:00 2001 From: olegphenomenon Date: Thu, 23 Dec 2021 15:14:36 +0200 Subject: [PATCH] updated tests --- .../epp/domain/update/base_test.rb | 88 ++++++++++--------- test/mailers/domain_expire_mailer_test.rb | 55 ++++++------ test/tasks/emails/verify_email_task_test.rb | 19 ---- 3 files changed, 73 insertions(+), 89 deletions(-) diff --git a/test/integration/epp/domain/update/base_test.rb b/test/integration/epp/domain/update/base_test.rb index 8800afecc..580d5c603 100644 --- a/test/integration/epp/domain/update/base_test.rb +++ b/test/integration/epp/domain/update/base_test.rb @@ -717,49 +717,51 @@ class EppDomainUpdateBaseTest < EppTestCase assert_no_emails end - def test_makes_update_if_was_forcedelete - contact = @domain.contacts.first - contact.update_attribute(:email, '`@outlook.test') - contact.verify_email - assert contact.email_verification_failed? - @domain.reload - assert @domain.force_delete_scheduled? - - @domain.update_attribute(:statuses_before_force_delete, nil) - - Setting.request_confirmation_on_registrant_change_enabled = true - new_registrant = contacts(:william).becomes(Registrant) - assert_not_equal new_registrant, @domain.registrant - - request_xml = <<-XML - - - - - - #{@domain.name} - - #{new_registrant.code} - - - - - - #{'test' * 2000} - - - - - XML - - post epp_update_path, params: { frame: request_xml }, - headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } - @domain.reload - - response_xml = Nokogiri::XML(response.body) - assert_correct_against_schema response_xml - assert_epp_response :completed_successfully - end + # COMMENT OU REASON: FOR EXPIRED DOMAIN SHOULD NOT SET FD + # def test_makes_update_if_was_forcedelete + # contact = @domain.contacts.first + # contact.update_attribute(:email, '`@outlook.test') + # contact.verify_email + # assert contact.email_verification_failed? + # @domain.reload + # + # assert @domain.force_delete_scheduled? + # + # @domain.update_attribute(:statuses_before_force_delete, nil) + # + # Setting.request_confirmation_on_registrant_change_enabled = true + # new_registrant = contacts(:william).becomes(Registrant) + # assert_not_equal new_registrant, @domain.registrant + # + # request_xml = <<-XML + # + # + # + # + # + # #{@domain.name} + # + # #{new_registrant.code} + # + # + # + # + # + # #{'test' * 2000} + # + # + # + # + # XML + # + # post epp_update_path, params: { frame: request_xml }, + # headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } + # @domain.reload + # + # response_xml = Nokogiri::XML(response.body) + # assert_correct_against_schema response_xml + # assert_epp_response :completed_successfully + # end def test_clears_force_delete_when_registrar_changed Setting.request_confirmation_on_registrant_change_enabled = true diff --git a/test/mailers/domain_expire_mailer_test.rb b/test/mailers/domain_expire_mailer_test.rb index febe089c2..ff2d93c79 100644 --- a/test/mailers/domain_expire_mailer_test.rb +++ b/test/mailers/domain_expire_mailer_test.rb @@ -29,31 +29,32 @@ class DomainExpireMailerTest < ActionMailer::TestCase email.subject end - def test_delivers_domain_expiration_soft_email_if_auto_fd - domain = domains(:shop) - email_address = domain.registrar.email - assert_not domain.force_delete_scheduled? - travel_to Time.zone.parse('2010-07-05') - email = '`@internet.ee' - - Truemail.configure.default_validation_type = :regex - - contact = domain.admin_contacts.first - contact.update_attribute(:email, email) - contact.verify_email - - assert contact.email_verification_failed? - - domain.reload - - assert domain.force_delete_scheduled? - - email = DomainExpireMailer.expired_soft(domain: domain, - registrar: domain.registrar, - email: email_address).deliver_now - - assert_emails 1 - assert_equal I18n.t("domain_expire_mailer.expired_soft.subject", domain_name: domain.name), - email.subject - end + # COMMENT OU REASON: FOR EXPIRED DOMAIN SHOULD NOT SET FD + # def test_delivers_domain_expiration_soft_email_if_auto_fd + # domain = domains(:shop) + # email_address = domain.registrar.email + # assert_not domain.force_delete_scheduled? + # travel_to Time.zone.parse('2010-07-05') + # email = '`@internet.ee' + # + # Truemail.configure.default_validation_type = :regex + # + # contact = domain.admin_contacts.first + # contact.update_attribute(:email, email) + # contact.verify_email + # + # assert contact.email_verification_failed? + # + # domain.reload + # + # assert_no domain.force_delete_scheduled? + # + # email = DomainExpireMailer.expired_soft(domain: domain, + # registrar: domain.registrar, + # email: email_address).deliver_now + # + # assert_emails 1 + # assert_equal I18n.t("domain_expire_mailer.expired_soft.subject", domain_name: domain.name), + # email.subject + # end end diff --git a/test/tasks/emails/verify_email_task_test.rb b/test/tasks/emails/verify_email_task_test.rb index dadec546a..a366708d9 100644 --- a/test/tasks/emails/verify_email_task_test.rb +++ b/test/tasks/emails/verify_email_task_test.rb @@ -100,25 +100,6 @@ class VerifyEmailTaskTest < ActiveJob::TestCase # assert_equal ValidationEvent.all.count, 9 # end - def test_should_set_fd_for_failed_email_after_several_times - contact = contacts(:john) - trumail_results = OpenStruct.new(success: false, - email: contact.email, - domain: "inbox.tests", - errors: {:mx=>"target host(s) not found"}, - ) - Spy.on_instance_method(Actions::EmailCheck, :check_email).and_return(trumail_results) - - - assert_not contact.domains.last.force_delete_scheduled? - - 3.times do - run_task - end - - assert contact.domains.last.force_delete_scheduled? - end - def test_fd_should_not_removed_if_change_email_to_another_invalid_one contact = contacts(:john)