Add a job to check if domain needs to be fd-lifted

This commit is contained in:
Alex Sherman 2021-04-06 10:15:54 +05:00
parent 6383dede4b
commit 39d392696a
5 changed files with 55 additions and 18 deletions

View file

@ -384,6 +384,33 @@ class ForceDeleteTest < ActionMailer::TestCase
assert notification.text.include? asserted_text
end
def test_lifts_force_delete_if_contact_fixed
@domain.update(valid_to: Time.zone.parse('2012-08-05'))
assert_not @domain.force_delete_scheduled?
travel_to Time.zone.parse('2010-07-05')
email = 'some@strangesentence@internet.ee'
Truemail.configure.default_validation_type = :regex
contact = @domain.admin_contacts.first
contact.update_attribute(:email, email)
contact.email_verification.verify
assert contact.email_verification_failed?
@domain.reload
assert @domain.force_delete_scheduled?
contact.update_attribute(:email, 'aaa@bbb.com')
contact.email_verification.verify
assert_not contact.email_verification_failed?
CheckForceDeleteLift.perform_now
@domain.reload
assert_not @domain.force_delete_scheduled?
end
def prepare_bounced_email_address(email)
@bounced_mail = BouncedMailAddress.new
@bounced_mail.email = email