mirror of
https://github.com/internetee/registry.git
synced 2025-06-10 22:54:47 +02:00
59 lines
1.5 KiB
Ruby
59 lines
1.5 KiB
Ruby
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
|