mirror of
https://github.com/internetee/registry.git
synced 2025-06-15 00:54:47 +02:00
Add Domain::Lockable concern
This commit is contained in:
parent
c1ea79615f
commit
43f65cc0aa
3 changed files with 106 additions and 0 deletions
59
test/models/domain/lockable_test.rb
Normal file
59
test/models/domain/lockable_test.rb
Normal file
|
@ -0,0 +1,59 @@
|
|||
require 'test_helper'
|
||||
|
||||
class DomainLockableTest < ActiveSupport::TestCase
|
||||
def setup
|
||||
super
|
||||
|
||||
@domain = domains(:shop)
|
||||
end
|
||||
|
||||
def test_registry_lock_on_lockable_domain
|
||||
refute(@domain.locked_by_registrant?)
|
||||
@domain.apply_registry_lock
|
||||
|
||||
assert_equal(
|
||||
[DomainStatus::SERVER_UPDATE_PROHIBITED,
|
||||
DomainStatus::SERVER_DELETE_PROHIBITED,
|
||||
DomainStatus::SERVER_TRANSFER_PROHIBITED],
|
||||
@domain.statuses
|
||||
)
|
||||
|
||||
assert(@domain.locked_by_registrant?)
|
||||
end
|
||||
|
||||
def test_registry_lock_cannot_be_applied_twice
|
||||
@domain.apply_registry_lock
|
||||
refute(@domain.apply_registry_lock)
|
||||
assert(@domain.locked_by_registrant?)
|
||||
end
|
||||
|
||||
def test_registry_lock_cannot_be_applied_on_pending_statuses
|
||||
@domain.statuses << DomainStatus::PENDING_RENEW
|
||||
refute(@domain.apply_registry_lock)
|
||||
refute(@domain.locked_by_registrant?)
|
||||
end
|
||||
|
||||
def test_remove_registry_lock_on_locked_domain
|
||||
@domain.apply_registry_lock
|
||||
|
||||
assert_equal(
|
||||
[DomainStatus::SERVER_UPDATE_PROHIBITED,
|
||||
DomainStatus::SERVER_DELETE_PROHIBITED,
|
||||
DomainStatus::SERVER_TRANSFER_PROHIBITED],
|
||||
@domain.statuses
|
||||
)
|
||||
|
||||
@domain.remove_registry_lock
|
||||
|
||||
assert_equal(["ok"], @domain.statuses)
|
||||
refute(@domain.locked_by_registrant?)
|
||||
end
|
||||
|
||||
def test_remove_registry_lock_on_non_locked_domain
|
||||
refute(@domain.locked_by_registrant?)
|
||||
refute(@domain.remove_registry_lock)
|
||||
|
||||
assert_equal([], @domain.statuses)
|
||||
refute(@domain.locked_by_registrant?)
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue