-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2368 from internetee/refactoring-job-validation-e…
…mail refactoring-job-validation-email
- Loading branch information
Showing
5 changed files
with
149 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -380,115 +380,115 @@ def test_schedules_force_delete_after_registrant_bounce | |
assert notification.text.include? asserted_text | ||
end | ||
|
||
def test_schedules_force_delete_invalid_contact | ||
@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 = '`@internet.ee' | ||
asserted_text = "Invalid email: #{email}" | ||
|
||
Truemail.configure.default_validation_type = :regex | ||
|
||
contact = @domain.admin_contacts.first | ||
contact.update_attribute(:email, email) | ||
|
||
ValidationEvent::VALID_EVENTS_COUNT_THRESHOLD.times do | ||
contact.verify_email | ||
end | ||
|
||
@domain.reload | ||
|
||
assert @domain.force_delete_scheduled? | ||
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 | ||
assert_equal @domain.status_notes[DomainStatus::FORCE_DELETE], email | ||
notification = @domain.registrar.notifications.last | ||
assert notification.text.include? asserted_text | ||
end | ||
|
||
def test_add_invalid_email_to_domain_status_notes | ||
domain = domains(:airport) | ||
domain.update(valid_to: Time.zone.parse('2012-08-05'), | ||
statuses: %w[serverForceDelete serverRenewProhibited serverTransferProhibited], | ||
force_delete_data: { 'template_name': 'invalid_email', 'force_delete_type': 'soft' }, | ||
status_notes: { "serverForceDelete": '`@internet2.ee' }) | ||
|
||
travel_to Time.zone.parse('2010-07-05') | ||
email = '`@internet.ee' | ||
invalid_emails = '`@internet2.ee `@internet.ee' | ||
asserted_text = "Invalid email: #{invalid_emails}" | ||
|
||
Truemail.configure.default_validation_type = :regex | ||
|
||
contact_first = domain.admin_contacts.first | ||
contact_first.update_attribute(:email_history, '[email protected]') | ||
contact_first.update_attribute(:email, email) | ||
|
||
ValidationEvent::VALID_EVENTS_COUNT_THRESHOLD.times do | ||
contact_first.verify_email | ||
end | ||
|
||
domain.reload | ||
|
||
assert_equal domain.status_notes[DomainStatus::FORCE_DELETE], invalid_emails | ||
notification = domain.registrar.notifications.last | ||
assert_not notification.text.include? asserted_text | ||
end | ||
|
||
def test_remove_invalid_email_from_domain_status_notes | ||
domain = domains(:airport) | ||
domain.update(valid_to: Time.zone.parse('2012-08-05'), | ||
statuses: %w[serverForceDelete serverRenewProhibited serverTransferProhibited], | ||
force_delete_data: { 'template_name': 'invalid_email', 'force_delete_type': 'soft' }, | ||
status_notes: { "serverForceDelete": '`@internet2.ee `@internet.ee' }) | ||
|
||
travel_to Time.zone.parse('2010-07-05') | ||
email = '`@internet2.ee' | ||
invalid_email = '`@internet.ee' | ||
asserted_text = "Invalid email: #{invalid_email}" | ||
|
||
Truemail.configure.default_validation_type = :regex | ||
|
||
contact_first = domain.admin_contacts.first | ||
contact_first.update_attribute(:email_history, email) | ||
contact_first.update_attribute(:email, '[email protected]') | ||
|
||
travel_to Time.zone.parse('2010-07-05 0:00:03') | ||
contact_first.verify_email | ||
domain.reload | ||
|
||
assert_equal domain.status_notes[DomainStatus::FORCE_DELETE], invalid_email | ||
notification = domain.registrar.notifications.last | ||
assert notification.text.include? asserted_text | ||
end | ||
|
||
def test_domain_should_have_several_bounced_emails | ||
@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_one = '`@internet.ee' | ||
email_two = '@@internet.ee' | ||
|
||
contact_one = @domain.admin_contacts.first | ||
contact_one.update_attribute(:email, email_one) | ||
contact_one.verify_email | ||
|
||
assert contact_one.need_to_start_force_delete? | ||
|
||
contact_two = @domain.admin_contacts.first | ||
contact_two.update_attribute(:email, email_two) | ||
contact_two.verify_email | ||
|
||
assert contact_two.need_to_start_force_delete? | ||
|
||
@domain.reload | ||
|
||
assert @domain.force_delete_scheduled? | ||
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 | ||
assert @domain.status_notes[DomainStatus::FORCE_DELETE].include? email_one | ||
assert @domain.status_notes[DomainStatus::FORCE_DELETE].include? email_two | ||
end | ||
# def test_schedules_force_delete_invalid_contact | ||
# @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 = '`@internet.ee' | ||
# asserted_text = "Invalid email: #{email}" | ||
|
||
# Truemail.configure.default_validation_type = :regex | ||
|
||
# contact = @domain.admin_contacts.first | ||
# contact.update_attribute(:email, email) | ||
|
||
# ValidationEvent::VALID_EVENTS_COUNT_THRESHOLD.times do | ||
# contact.verify_email | ||
# end | ||
|
||
# @domain.reload | ||
|
||
# assert @domain.force_delete_scheduled? | ||
# 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 | ||
# assert_equal @domain.status_notes[DomainStatus::FORCE_DELETE], email | ||
# notification = @domain.registrar.notifications.last | ||
# assert notification.text.include? asserted_text | ||
# end | ||
|
||
# def test_add_invalid_email_to_domain_status_notes | ||
# domain = domains(:airport) | ||
# domain.update(valid_to: Time.zone.parse('2012-08-05'), | ||
# statuses: %w[serverForceDelete serverRenewProhibited serverTransferProhibited], | ||
# force_delete_data: { 'template_name': 'invalid_email', 'force_delete_type': 'soft' }, | ||
# status_notes: { "serverForceDelete": '`@internet2.ee' }) | ||
|
||
# travel_to Time.zone.parse('2010-07-05') | ||
# email = '`@internet.ee' | ||
# invalid_emails = '`@internet2.ee `@internet.ee' | ||
# asserted_text = "Invalid email: #{invalid_emails}" | ||
|
||
# Truemail.configure.default_validation_type = :regex | ||
|
||
# contact_first = domain.admin_contacts.first | ||
# contact_first.update_attribute(:email_history, '[email protected]') | ||
# contact_first.update_attribute(:email, email) | ||
|
||
# ValidationEvent::VALID_EVENTS_COUNT_THRESHOLD.times do | ||
# contact_first.verify_email | ||
# end | ||
|
||
# domain.reload | ||
|
||
# assert_equal domain.status_notes[DomainStatus::FORCE_DELETE], invalid_emails | ||
# notification = domain.registrar.notifications.last | ||
# assert_not notification.text.include? asserted_text | ||
# end | ||
|
||
# def test_remove_invalid_email_from_domain_status_notes | ||
# domain = domains(:airport) | ||
# domain.update(valid_to: Time.zone.parse('2012-08-05'), | ||
# statuses: %w[serverForceDelete serverRenewProhibited serverTransferProhibited], | ||
# force_delete_data: { 'template_name': 'invalid_email', 'force_delete_type': 'soft' }, | ||
# status_notes: { "serverForceDelete": '`@internet2.ee `@internet.ee' }) | ||
|
||
# travel_to Time.zone.parse('2010-07-05') | ||
# email = '`@internet2.ee' | ||
# invalid_email = '`@internet.ee' | ||
# asserted_text = "Invalid email: #{invalid_email}" | ||
|
||
# Truemail.configure.default_validation_type = :regex | ||
|
||
# contact_first = domain.admin_contacts.first | ||
# contact_first.update_attribute(:email_history, email) | ||
# contact_first.update_attribute(:email, '[email protected]') | ||
|
||
# travel_to Time.zone.parse('2010-07-05 0:00:03') | ||
# contact_first.verify_email | ||
# domain.reload | ||
|
||
# assert_equal domain.status_notes[DomainStatus::FORCE_DELETE], invalid_email | ||
# notification = domain.registrar.notifications.last | ||
# assert notification.text.include? asserted_text | ||
# end | ||
|
||
# def test_domain_should_have_several_bounced_emails | ||
# @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_one = '`@internet.ee' | ||
# email_two = '@@internet.ee' | ||
|
||
# contact_one = @domain.admin_contacts.first | ||
# contact_one.update_attribute(:email, email_one) | ||
# contact_one.verify_email | ||
|
||
# assert contact_one.need_to_start_force_delete? | ||
|
||
# contact_two = @domain.admin_contacts.first | ||
# contact_two.update_attribute(:email, email_two) | ||
# contact_two.verify_email | ||
|
||
# assert contact_two.need_to_start_force_delete? | ||
|
||
# @domain.reload | ||
|
||
# assert @domain.force_delete_scheduled? | ||
# 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 | ||
# assert @domain.status_notes[DomainStatus::FORCE_DELETE].include? email_one | ||
# assert @domain.status_notes[DomainStatus::FORCE_DELETE].include? email_two | ||
# end | ||
|
||
def test_lifts_force_delete_after_bounce_changes | ||
@domain.update(valid_to: Time.zone.parse('2012-08-05')) | ||
|