mirror of
https://github.com/internetee/registry.git
synced 2025-06-06 12:47:29 +02:00
Add test for clear force delete on registrar change
This commit is contained in:
parent
c252d801f9
commit
e7581246d6
5 changed files with 43 additions and 3 deletions
|
@ -25,7 +25,7 @@ module Concerns::Domain::ForceDelete # rubocop:disable Metrics/ModuleLength
|
||||||
|
|
||||||
def should_notify_on_soft_force_delete?
|
def should_notify_on_soft_force_delete?
|
||||||
force_delete_scheduled? && contact_notification_sent_date.blank? &&
|
force_delete_scheduled? && contact_notification_sent_date.blank? &&
|
||||||
force_delete_start.to_date == Time.zone.now.to_date && force_delete_type.to_sym == :soft
|
force_delete_start.to_date <= Time.zone.now.to_date && force_delete_type.to_sym == :soft
|
||||||
end
|
end
|
||||||
|
|
||||||
def client_holdable?
|
def client_holdable?
|
||||||
|
|
|
@ -156,6 +156,7 @@ class NewDomainForceDeleteTest < ActiveSupport::TestCase
|
||||||
asserted_status = DomainStatus::CLIENT_HOLD
|
asserted_status = DomainStatus::CLIENT_HOLD
|
||||||
|
|
||||||
@domain.update(valid_to: Time.zone.parse('2012-08-05'))
|
@domain.update(valid_to: Time.zone.parse('2012-08-05'))
|
||||||
|
@domain.update(template_name: 'legal_person')
|
||||||
assert_not @domain.force_delete_scheduled?
|
assert_not @domain.force_delete_scheduled?
|
||||||
travel_to Time.zone.parse('2010-07-05')
|
travel_to Time.zone.parse('2010-07-05')
|
||||||
@domain.schedule_force_delete(type: :soft)
|
@domain.schedule_force_delete(type: :soft)
|
||||||
|
|
|
@ -23,4 +23,19 @@ class DomainCronTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
assert_emails 1
|
assert_emails 1
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
def test_client_hold
|
||||||
|
Setting.redemption_grace_period = 30
|
||||||
|
|
||||||
|
@domain.update(valid_to: Time.zone.parse('2012-08-05'))
|
||||||
|
assert_not @domain.force_delete_scheduled?
|
||||||
|
travel_to Time.zone.parse('2010-07-05')
|
||||||
|
@domain.schedule_force_delete(type: :soft)
|
||||||
|
@domain.reload
|
||||||
|
@domain.update(template_name: 'legal_person')
|
||||||
|
travel_to Time.zone.parse('2010-08-06')
|
||||||
|
DomainCron.start_client_hold
|
||||||
|
|
||||||
|
assert_emails 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
|
@ -405,6 +405,22 @@ class DomainTest < ActiveSupport::TestCase
|
||||||
assert_not domain.active?
|
assert_not domain.active?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_registrant_change_removes_force_delete
|
||||||
|
@domain.update_columns(valid_to: Time.zone.parse('2010-10-05'),
|
||||||
|
force_delete_date: nil)
|
||||||
|
@domain.update(template_name: 'legal_person')
|
||||||
|
travel_to Time.zone.parse('2010-07-05')
|
||||||
|
@domain.schedule_force_delete(type: :fast_track)
|
||||||
|
assert(@domain.force_delete_scheduled?)
|
||||||
|
other_registrant = Registrant.find_by(code: 'jane-001')
|
||||||
|
@domain.pending_json['new_registrant_id'] = other_registrant.id
|
||||||
|
|
||||||
|
@domain.registrant = other_registrant
|
||||||
|
@domain.save!
|
||||||
|
|
||||||
|
assert_not(@domain.force_delete_scheduled?)
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def valid_domain
|
def valid_domain
|
||||||
|
|
|
@ -28,7 +28,7 @@ class AdminAreaDomainForceDeleteTest < ApplicationSystemTestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_notifies_registrant_and_admin_contacts_by_email_by_default
|
def test_notifies_registrant_and_admin_contacts_by_email_if_fast_delete
|
||||||
assert_emails 1 do
|
assert_emails 1 do
|
||||||
visit edit_admin_domain_url(@domain)
|
visit edit_admin_domain_url(@domain)
|
||||||
find(:css, '#soft_delete').set(false)
|
find(:css, '#soft_delete').set(false)
|
||||||
|
@ -36,6 +36,14 @@ class AdminAreaDomainForceDeleteTest < ApplicationSystemTestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_notifies_registrant_and_admin_contacts_by_email_if_soft_delete
|
||||||
|
assert_emails 0 do
|
||||||
|
visit edit_admin_domain_url(@domain)
|
||||||
|
find(:css, '#soft_delete').set(true)
|
||||||
|
click_link_or_button 'Force delete domain'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def test_allows_to_skip_notifying_registrant_and_admin_contacts_by_email
|
def test_allows_to_skip_notifying_registrant_and_admin_contacts_by_email
|
||||||
assert_no_emails do
|
assert_no_emails do
|
||||||
visit edit_admin_domain_url(@domain)
|
visit edit_admin_domain_url(@domain)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue