Merge branch 'master' into 93-locked-domains-failed-after-fc

This commit is contained in:
OlegPhenomenon 2021-09-24 09:32:27 +03:00 committed by GitHub
commit ab26100e78
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 269 additions and 69 deletions

View file

@ -47,7 +47,7 @@ class RegistrantApiRegistryLocksTest < ApplicationIntegrationTest
end
def test_cannot_lock_an_already_locked_domain
@domain.apply_registry_lock
@domain.apply_registry_lock(extensions_prohibited: false)
assert(@domain.locked_by_registrant?)
post '/api/v1/registrant/domains/2df2c1a1-8f6a-490a-81be-8bdf29866880/registry_lock',
@ -59,7 +59,7 @@ class RegistrantApiRegistryLocksTest < ApplicationIntegrationTest
end
def test_can_unlock_a_locked_domain
@domain.apply_registry_lock
@domain.apply_registry_lock(extensions_prohibited: false)
delete '/api/v1/registrant/domains/2df2c1a1-8f6a-490a-81be-8bdf29866880/registry_lock',
headers: @auth_headers

View file

@ -22,14 +22,14 @@ class DomainUpdateConfirmJobTest < ActiveSupport::TestCase
def test_registrant_locked_domain
refute @domain.locked_by_registrant?
@domain.apply_registry_lock
@domain.apply_registry_lock(extensions_prohibited: false)
assert @domain.locked_by_registrant?
assert_equal(@domain.registrar.notifications.last.text, "Domain #{@domain.name} has been locked by registrant")
end
def test_registrant_unlocked_domain
refute @domain.locked_by_registrant?
@domain.apply_registry_lock
@domain.apply_registry_lock(extensions_prohibited: false)
assert @domain.locked_by_registrant?
@domain.remove_registry_lock
refute @domain.locked_by_registrant?

View file

@ -0,0 +1,72 @@
require 'test_helper'
class ReplaceUpdToObjUpdProhibitedJobTest < ActiveSupport::TestCase
include ActiveJob::TestHelper
setup do
travel_to Time.zone.parse('2010-07-05')
@domain = domains(:shop)
end
def test_start_adding_new_status_for_locked_domains
@domain.apply_registry_lock(extensions_prohibited: false)
assert @domain.locked_by_registrant?
perform_enqueued_jobs do
ReplaceUpdToObjUpdProhibitedJob.perform_later
end
@domain.reload
assert @domain.statuses.include? "serverObjUpdateProhibited"
end
def test_start_adding_new_status_for_locked_domains
@domain.apply_registry_lock(extensions_prohibited: false)
assert @domain.locked_by_registrant?
assert @domain.statuses.include? "serverUpdateProhibited"
# @domain.statuses += ["serverObjUpdateProhibited"]
# @domain.save
# @domain.reload
# assert @domain.statuses.include? "serverObjUpdateProhibited"
perform_enqueued_jobs do
ReplaceUpdToObjUpdProhibitedJob.perform_later
end
@domain.reload
assert_not @domain.statuses.include? "serverUpdateProhibited"
end
def test_should_not_added_to_non_locked_domain_with_update_prohibited
@domain.statuses += ["serverUpdateProhibited"]
@domain.save
@domain.reload
assert @domain.statuses.include? "serverUpdateProhibited"
assert_not @domain.locked_by_registrant?
perform_enqueued_jobs do
ReplaceUpdToObjUpdProhibitedJob.perform_later
end
assert_not @domain.statuses.include? "serverObjUpdateProhibited"
end
def test_should_not_removed_from_non_locked_domain_with_update_prohibited
@domain.statuses += ["serverUpdateProhibited"]
@domain.save
@domain.reload
assert @domain.statuses.include? "serverUpdateProhibited"
assert_not @domain.locked_by_registrant?
perform_enqueued_jobs do
ReplaceUpdToObjUpdProhibitedJob.perform_later
end
assert @domain.statuses.include? "serverUpdateProhibited"
end
end

View file

@ -16,7 +16,7 @@ class SerializersRegistrantApiDomainTest < ActiveSupport::TestCase
assert_not(@json[:locked_by_registrant_at])
travel_to Time.zone.parse('2010-07-05 10:30')
@domain.apply_registry_lock
@domain.apply_registry_lock(extensions_prohibited: false)
serializer_for_locked_domain = Serializers::RegistrantApi::Domain.new(@domain.reload)
new_json = serializer_for_locked_domain.to_json

View file

@ -31,7 +31,7 @@ class DomainVersionTest < ActiveSupport::TestCase
PaperTrail.request.whodunnit = @user.id_role_username
assert_difference '@domain.versions.count', 1 do
@domain.apply_registry_lock
@domain.apply_registry_lock(extensions_prohibited: false)
end
assert_equal(@domain.updator, @user)

View file

@ -11,14 +11,14 @@ class DomainRegistryLockableTest < ActiveSupport::TestCase
refute(@domain.locked_by_registrant?)
@domain.update(statuses: [DomainStatus::SERVER_TRANSFER_PROHIBITED])
@domain.apply_registry_lock # Raise validation error
@domain.apply_registry_lock(extensions_prohibited: false) # Raise validation error
check_statuses_lockable_domain
assert(@domain.locked_by_registrant?)
end
def test_remove_lockalable_statuses_after_admin_intervention
@domain.apply_registry_lock
@domain.apply_registry_lock(extensions_prohibited: false)
assert @domain.locked_by_registrant?
assert_equal @domain.statuses.sort, Domain::RegistryLockable::LOCK_STATUSES.sort
@ -26,7 +26,7 @@ class DomainRegistryLockableTest < ActiveSupport::TestCase
@domain.update(statuses: deleted_status)
assert_not @domain.locked_by_registrant?
@domain.apply_registry_lock
@domain.apply_registry_lock(extensions_prohibited: false)
assert @domain.locked_by_registrant?
@domain.remove_registry_lock
@ -41,7 +41,7 @@ class DomainRegistryLockableTest < ActiveSupport::TestCase
@domain.save
assert @domain.admin_store_statuses_history.include? DomainStatus::SERVER_UPDATE_PROHIBITED
@domain.apply_registry_lock
@domain.apply_registry_lock(extensions_prohibited: false)
assert @domain.locked_by_registrant?
assert_equal @domain.statuses.sort, Domain::RegistryLockable::LOCK_STATUSES.sort
@ -52,7 +52,7 @@ class DomainRegistryLockableTest < ActiveSupport::TestCase
end
def test_add_additinal_status_for_locked_domain
@domain.apply_registry_lock
@domain.apply_registry_lock(extensions_prohibited: false)
assert @domain.locked_by_registrant?
assert_equal @domain.statuses.sort, Domain::RegistryLockable::LOCK_STATUSES.sort
@ -69,7 +69,7 @@ class DomainRegistryLockableTest < ActiveSupport::TestCase
def test_lockable_domain_if_remove_some_prohibited_status
refute(@domain.locked_by_registrant?)
@domain.apply_registry_lock
@domain.apply_registry_lock(extensions_prohibited: false)
check_statuses_lockable_domain
assert(@domain.locked_by_registrant?)
@ -85,7 +85,7 @@ class DomainRegistryLockableTest < ActiveSupport::TestCase
def test_registry_lock_on_lockable_domain
refute(@domain.locked_by_registrant?)
@domain.apply_registry_lock
@domain.apply_registry_lock(extensions_prohibited: false)
assert_equal(
[DomainStatus::SERVER_UPDATE_PROHIBITED,
@ -99,21 +99,21 @@ class DomainRegistryLockableTest < ActiveSupport::TestCase
end
def test_registry_lock_cannot_be_applied_twice
@domain.apply_registry_lock
refute(@domain.apply_registry_lock)
@domain.apply_registry_lock(extensions_prohibited: false)
refute(@domain.apply_registry_lock(extensions_prohibited: false))
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.apply_registry_lock(extensions_prohibited: false))
refute(@domain.locked_by_registrant?)
refute(@domain.locked_by_registrant_at)
end
def test_remove_registry_lock_on_locked_domain
@domain.apply_registry_lock
@domain.apply_registry_lock(extensions_prohibited: false)
assert_equal(
[DomainStatus::SERVER_UPDATE_PROHIBITED,

View file

@ -1,6 +1,11 @@
require 'test_helper'
class FeatureTest < ActiveSupport::TestCase
setup do
@domain = domains(:shop)
@domain.apply_registry_lock(extensions_prohibited: false)
end
def test_if_obj_and_extensions_prohibited_enabled
ENV['obj_and_extensions_prohibited'] = 'true'
@ -27,4 +32,22 @@ class FeatureTest < ActiveSupport::TestCase
statuses = DomainStatus.admin_statuses
assert_not statuses.include? DomainStatus::SERVER_OBJ_UPDATE_PROHIBITED
end
def test_if_enable_lock_domain_with_new_statuses_is_nil
ENV['enable_lock_domain_with_new_statuses'] = nil
assert_not Feature.enable_lock_domain_with_new_statuses?
assert_equal @domain.statuses, ["serverUpdateProhibited", "serverDeleteProhibited", "serverTransferProhibited"]
assert @domain.locked_by_registrant?
end
def test_if_enable_lock_domain_with_new_statuses_is_false
ENV['enable_lock_domain_with_new_statuses'] = 'false'
assert_not Feature.enable_lock_domain_with_new_statuses?
assert_equal @domain.statuses, ["serverUpdateProhibited", "serverDeleteProhibited", "serverTransferProhibited"]
assert @domain.locked_by_registrant?
end
end

View file

@ -17,7 +17,7 @@ class AdminAreaRegistryLockTest < JavaScriptApplicationSystemTestCase
end
def test_can_remove_registry_lock_from_a_domain
@domain.apply_registry_lock
@domain.apply_registry_lock(extensions_prohibited: false)
visit edit_admin_domain_path(@domain)
click_link_or_button('Actions')
@ -34,7 +34,7 @@ class AdminAreaRegistryLockTest < JavaScriptApplicationSystemTestCase
end
def test_cannot_remove_registry_lock_from_not_locked_domain
@domain.apply_registry_lock
@domain.apply_registry_lock(extensions_prohibited: false)
visit edit_admin_domain_path(@domain)
@domain.remove_registry_lock

View file

@ -20,7 +20,7 @@ class AdminDomainsTestTest < ApplicationSystemTestCase
refute_text 'Registry lock time 2010-07-05 00:30'
lockable_domain = domains(:airport)
lockable_domain.apply_registry_lock
lockable_domain.apply_registry_lock(extensions_prohibited: false)
visit admin_domain_path(lockable_domain)
assert_text 'Registry lock time 2010-07-05 00:30'