mirror of
https://github.com/internetee/registry.git
synced 2025-06-10 14:44:47 +02:00
Add ability for admin to remove registry lock
This commit is contained in:
parent
4743b1e2a5
commit
dffe865d89
10 changed files with 174 additions and 29 deletions
|
@ -4,7 +4,7 @@ class DomainLockableTest < ActiveSupport::TestCase
|
|||
def setup
|
||||
super
|
||||
|
||||
@domain = domains(:shop)
|
||||
@domain = domains(:airport)
|
||||
end
|
||||
|
||||
def test_registry_lock_on_lockable_domain
|
||||
|
@ -19,18 +19,21 @@ class DomainLockableTest < ActiveSupport::TestCase
|
|||
)
|
||||
|
||||
assert(@domain.locked_by_registrant?)
|
||||
assert(@domain.locked_by_registrant_at)
|
||||
end
|
||||
|
||||
def test_registry_lock_cannot_be_applied_twice
|
||||
@domain.apply_registry_lock
|
||||
refute(@domain.apply_registry_lock)
|
||||
assert(@domain.locked_by_registrant?)
|
||||
assert(@domain.locked_by_registrant_at)
|
||||
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?)
|
||||
refute(@domain.locked_by_registrant_at)
|
||||
end
|
||||
|
||||
def test_remove_registry_lock_on_locked_domain
|
||||
|
@ -47,6 +50,7 @@ class DomainLockableTest < ActiveSupport::TestCase
|
|||
|
||||
assert_equal(["ok"], @domain.statuses)
|
||||
refute(@domain.locked_by_registrant?)
|
||||
refute(@domain.locked_by_registrant_at)
|
||||
end
|
||||
|
||||
def test_remove_registry_lock_on_non_locked_domain
|
||||
|
@ -55,5 +59,14 @@ class DomainLockableTest < ActiveSupport::TestCase
|
|||
|
||||
assert_equal([], @domain.statuses)
|
||||
refute(@domain.locked_by_registrant?)
|
||||
refute(@domain.locked_by_registrant_at)
|
||||
end
|
||||
|
||||
def test_registry_lock_cannot_be_removed_if_statuses_were_set_by_admin
|
||||
@domain.statuses << DomainStatus::SERVER_UPDATE_PROHIBITED
|
||||
@domain.statuses << DomainStatus::SERVER_DELETE_PROHIBITED
|
||||
@domain.statuses << DomainStatus::SERVER_TRANSFER_PROHIBITED
|
||||
|
||||
refute(@domain.remove_registry_lock)
|
||||
end
|
||||
end
|
||||
|
|
55
test/system/admin_area/domains/registry_lock_test.rb
Normal file
55
test/system/admin_area/domains/registry_lock_test.rb
Normal file
|
@ -0,0 +1,55 @@
|
|||
require 'test_helper'
|
||||
|
||||
class RegistryLockTest < JavaScriptApplicationSystemTestCase
|
||||
def setup
|
||||
super
|
||||
WebMock.allow_net_connect!
|
||||
|
||||
sign_in users(:admin)
|
||||
travel_to Time.zone.parse('2010-07-05 00:30:00')
|
||||
@domain = domains(:airport)
|
||||
end
|
||||
|
||||
def teardown
|
||||
travel_back
|
||||
end
|
||||
|
||||
def test_does_not_have_link_when_domain_is_not_locked
|
||||
visit edit_admin_domain_path(@domain)
|
||||
refute(page.has_link?('Remove registry lock'))
|
||||
end
|
||||
|
||||
def test_can_remove_registry_lock_from_a_domain
|
||||
@domain.apply_registry_lock
|
||||
|
||||
visit edit_admin_domain_path(@domain)
|
||||
click_link_or_button('Actions')
|
||||
assert(page.has_link?('Remove registry lock'))
|
||||
|
||||
accept_confirm('Are you sure you want to remove registry lock that was set by registrant?') do
|
||||
click_link_or_button('Remove registry lock')
|
||||
end
|
||||
|
||||
assert_text('Registry lock removed')
|
||||
|
||||
@domain.reload
|
||||
refute @domain.locked_by_registrant?
|
||||
end
|
||||
|
||||
def test_cannot_remove_registry_lock_from_not_locked_domain
|
||||
@domain.apply_registry_lock
|
||||
visit edit_admin_domain_path(@domain)
|
||||
@domain.remove_registry_lock
|
||||
|
||||
refute @domain.locked_by_registrant?
|
||||
|
||||
click_link_or_button('Actions')
|
||||
assert(page.has_link?('Remove registry lock'))
|
||||
|
||||
accept_confirm('Are you sure you want to remove registry lock that was set by registrant?') do
|
||||
click_link_or_button('Remove registry lock')
|
||||
end
|
||||
|
||||
assert_text('Registry lock could not be removed')
|
||||
end
|
||||
end
|
|
@ -3,11 +3,27 @@ require 'test_helper'
|
|||
class AdminDomainsTestTest < ApplicationSystemTestCase
|
||||
setup do
|
||||
sign_in users(:admin)
|
||||
travel_to Time.zone.parse('2010-07-05 00:30:00')
|
||||
@domain = domains(:shop)
|
||||
end
|
||||
|
||||
teardown do
|
||||
travel_back
|
||||
end
|
||||
|
||||
def test_shows_details
|
||||
domain = domains(:shop)
|
||||
visit admin_domain_path(domain)
|
||||
assert_field nil, with: domain.transfer_code
|
||||
visit admin_domain_path(@domain)
|
||||
assert_field nil, with: @domain.transfer_code
|
||||
end
|
||||
|
||||
def test_admin_registry_lock_date
|
||||
visit admin_domain_path(@domain)
|
||||
refute_text 'Registry lock time 2010-07-05 00:30'
|
||||
|
||||
lockable_domain = domains(:airport)
|
||||
lockable_domain.apply_registry_lock
|
||||
|
||||
visit admin_domain_path(lockable_domain)
|
||||
assert_text 'Registry lock time 2010-07-05 00:30'
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue