Add checking if any of domain emails still got bounce related

This commit is contained in:
Alex Sherman 2021-04-06 12:36:32 +05:00
parent 39d392696a
commit 95a2b705b4
3 changed files with 46 additions and 2 deletions

View file

@ -410,6 +410,32 @@ class ForceDeleteTest < ActionMailer::TestCase
@domain.reload
assert_not @domain.force_delete_scheduled?
end
def test_lifts_force_delete_after_bounce_changes
@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 = @domain.registrant.email
asserted_text = "Invalid email: #{email}"
prepare_bounced_email_address(email)
@domain.reload
assert @domain.force_delete_scheduled?
assert_equal 'invalid_email', @domain.template_name
assert_equal Date.parse('2010-09-19'), @domain.force_delete_date.to_date
assert_equal Date.parse('2010-08-05'), @domain.force_delete_start.to_date
notification = @domain.registrar.notifications.last
assert notification.text.include? asserted_text
@domain.registrant.update(email: 'aaa@bbb.com')
@domain.registrant.email_verification.verify
assert_not @domain.registrant.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