Merge pull request #1707 from internetee/1705-removing-pendingUpdate-status-fails-if-domain-has-forceDelete-status-set

Domain: Don't respect forceDelete status when determining pending_update?
This commit is contained in:
Timo Võhmar 2020-10-09 18:48:03 +03:00 committed by GitHub
commit 428054e401
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 1 deletions

View file

@ -489,7 +489,7 @@ class Domain < ApplicationRecord
end
def pending_update?
statuses.include?(DomainStatus::PENDING_UPDATE) && !statuses.include?(DomainStatus::FORCE_DELETE)
statuses.include?(DomainStatus::PENDING_UPDATE)
end
# depricated not used, not valid

View file

@ -242,4 +242,14 @@ class NewDomainForceDeleteTest < ActiveSupport::TestCase
assert_not_includes(@domain.statuses, asserted_status)
end
def test_force_delete_does_not_affect_pending_update_check
@domain.schedule_force_delete(type: :soft)
@domain.reload
@domain.statuses << DomainStatus::PENDING_UPDATE
assert @domain.force_delete_scheduled?
assert @domain.pending_update?
end
end

View file

@ -52,4 +52,26 @@ class DomainCronTest < ActiveSupport::TestCase
assert_emails 0
end
def test_cleans_expired_pendings_when_force_delete_active
Setting.expire_pending_confirmation = 0
# Set force delete
@domain.schedule_force_delete(type: :soft)
@domain.reload
@domain.statuses << DomainStatus::PENDING_UPDATE
# Set domain registrant change that's expired
@domain.update!(registrant_verification_asked_at: Time.zone.now,
registrant_verification_token: 'test',
statuses: @domain.statuses)
assert @domain.pending_update?
@domain.reload
DomainCron.clean_expired_pendings
@domain.reload
assert_not @domain.pending_update?
end
end