From f9436062a6787f88f4418ff124b4ca0b06ee4d0d Mon Sep 17 00:00:00 2001 From: olegphenomenon Date: Tue, 21 Sep 2021 16:08:40 +0300 Subject: [PATCH 1/4] init --- .idea/workspace.xml | 181 ++++++++++++++++++ .../registrant/registry_locks_controller.rb | 2 + .../concerns/domain/registry_lockable.rb | 1 - app/models/registrant_user.rb | 6 +- 4 files changed, 186 insertions(+), 4 deletions(-) create mode 100644 .idea/workspace.xml diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000000..a7cd52260d --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1623134418422 + + + + + + + + + \ No newline at end of file diff --git a/app/controllers/api/v1/registrant/registry_locks_controller.rb b/app/controllers/api/v1/registrant/registry_locks_controller.rb index a8f420ae54..a97d1c62b8 100644 --- a/app/controllers/api/v1/registrant/registry_locks_controller.rb +++ b/app/controllers/api/v1/registrant/registry_locks_controller.rb @@ -8,6 +8,8 @@ class RegistryLocksController < ::Api::V1::Registrant::BaseController before_action :authorized_to_manage_locks? def create + p "============" + if @domain.apply_registry_lock render json: serialized_domain(@domain) else diff --git a/app/models/concerns/domain/registry_lockable.rb b/app/models/concerns/domain/registry_lockable.rb index 240694d8eb..7ee9860a82 100644 --- a/app/models/concerns/domain/registry_lockable.rb +++ b/app/models/concerns/domain/registry_lockable.rb @@ -12,7 +12,6 @@ module Domain::RegistryLockable end def apply_registry_lock - # binding.pry return unless registry_lockable? return if locked_by_registrant? diff --git a/app/models/registrant_user.rb b/app/models/registrant_user.rb index f7e85c5af5..c6d80901e8 100644 --- a/app/models/registrant_user.rb +++ b/app/models/registrant_user.rb @@ -17,11 +17,11 @@ def country Country.new(alpha2_code) end - def companies(company_register = CompanyRegister::Client.new) + def companies(company_register = nil) return [] if ident.include?('-') - company_register.representation_rights(citizen_personal_code: ident, - citizen_country_code: country.alpha3) + [OpenStruct.new(registration_number: '43344412', company_name: 'TestFirma'), + OpenStruct.new(registration_number: '12345678', company_name: 'SuperFirma OU')] end def contacts(representable: true) From 1bb5dddd58932b62582eb0bc18e7e1659699821d Mon Sep 17 00:00:00 2001 From: olegphenomenon Date: Tue, 21 Sep 2021 16:45:09 +0300 Subject: [PATCH 2/4] added abbility for added extenstions prohibited status --- .../registrant/registry_locks_controller.rb | 4 ++-- .../concerns/domain/registry_lockable.rb | 9 ++++++++- app/models/registrant_user.rb | 8 ++++---- .../registrant_api_registry_locks_test.rb | 2 +- test/jobs/domain_update_confirm_job_test.rb | 4 ++-- .../serializers/registrant_api/domain_test.rb | 2 +- test/models/domain/domain_version_test.rb | 2 +- test/models/domain/registry_lockable_test.rb | 20 +++++++++---------- .../admin_area/domains/registry_lock_test.rb | 4 ++-- test/system/admin_area/domains_test.rb | 2 +- 10 files changed, 32 insertions(+), 25 deletions(-) diff --git a/app/controllers/api/v1/registrant/registry_locks_controller.rb b/app/controllers/api/v1/registrant/registry_locks_controller.rb index a97d1c62b8..1efffeb751 100644 --- a/app/controllers/api/v1/registrant/registry_locks_controller.rb +++ b/app/controllers/api/v1/registrant/registry_locks_controller.rb @@ -8,9 +8,9 @@ class RegistryLocksController < ::Api::V1::Registrant::BaseController before_action :authorized_to_manage_locks? def create - p "============" + extensionsProhibited = params[:extensionsProhibited] - if @domain.apply_registry_lock + if @domain.apply_registry_lock(extensionsProhibited: extensionsProhibited.to_s.downcase == "true") render json: serialized_domain(@domain) else render json: { errors: [{ base: ['Domain cannot be locked'] }] }, diff --git a/app/models/concerns/domain/registry_lockable.rb b/app/models/concerns/domain/registry_lockable.rb index 7ee9860a82..98f1c89176 100644 --- a/app/models/concerns/domain/registry_lockable.rb +++ b/app/models/concerns/domain/registry_lockable.rb @@ -11,12 +11,16 @@ module Domain::RegistryLockable DomainStatus::SERVER_TRANSFER_PROHIBITED].freeze end - def apply_registry_lock + EXTENSIONS_STATUS = [DomainStatus::SERVER_EXTENSION_UPDATE_PROHIBITED].freeze + + + def apply_registry_lock(extensionsProhibited:) return unless registry_lockable? return if locked_by_registrant? transaction do self.statuses |= LOCK_STATUSES + self.statuses |= EXTENSIONS_STATUS if Feature.obj_and_extensions_statuses_enabled? and extensionsProhibited self.locked_by_registrant_at = Time.zone.now alert_registrar_lock_changes!(lock: true) @@ -44,6 +48,9 @@ def remove_registry_lock LOCK_STATUSES.each do |domain_status| statuses.delete([domain_status]) end + + statuses.delete([EXTENSIONS_STATUS]) if statuses.include? EXTENSIONS_STATUS + self.locked_by_registrant_at = nil self.statuses = admin_store_statuses_history || [] alert_registrar_lock_changes!(lock: false) diff --git a/app/models/registrant_user.rb b/app/models/registrant_user.rb index c6d80901e8..57a2f58ab9 100644 --- a/app/models/registrant_user.rb +++ b/app/models/registrant_user.rb @@ -17,13 +17,13 @@ def country Country.new(alpha2_code) end - def companies(company_register = nil) + def companies(company_register = CompanyRegister::Client.new) return [] if ident.include?('-') - [OpenStruct.new(registration_number: '43344412', company_name: 'TestFirma'), - OpenStruct.new(registration_number: '12345678', company_name: 'SuperFirma OU')] + company_register.representation_rights(citizen_personal_code: ident, + citizen_country_code: country.alpha3) end - + def contacts(representable: true) Contact.registrant_user_contacts(self, representable: representable) end diff --git a/test/integration/api/registrant/registrant_api_registry_locks_test.rb b/test/integration/api/registrant/registrant_api_registry_locks_test.rb index 0de47dbc9f..c119425a29 100644 --- a/test/integration/api/registrant/registrant_api_registry_locks_test.rb +++ b/test/integration/api/registrant/registrant_api_registry_locks_test.rb @@ -47,7 +47,7 @@ def test_cannot_lock_a_domain_in_pending_state end def test_cannot_lock_an_already_locked_domain - @domain.apply_registry_lock + @domain.apply_registry_lock(extensionsProhibited: false) assert(@domain.locked_by_registrant?) post '/api/v1/registrant/domains/2df2c1a1-8f6a-490a-81be-8bdf29866880/registry_lock', diff --git a/test/jobs/domain_update_confirm_job_test.rb b/test/jobs/domain_update_confirm_job_test.rb index 183fd5cf1e..54a144424c 100644 --- a/test/jobs/domain_update_confirm_job_test.rb +++ b/test/jobs/domain_update_confirm_job_test.rb @@ -22,14 +22,14 @@ def teardown def test_registrant_locked_domain refute @domain.locked_by_registrant? - @domain.apply_registry_lock + @domain.apply_registry_lock(extensionsProhibited: 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(extensionsProhibited: false) assert @domain.locked_by_registrant? @domain.remove_registry_lock refute @domain.locked_by_registrant? diff --git a/test/lib/serializers/registrant_api/domain_test.rb b/test/lib/serializers/registrant_api/domain_test.rb index 2e68e42931..a207b649f6 100644 --- a/test/lib/serializers/registrant_api/domain_test.rb +++ b/test/lib/serializers/registrant_api/domain_test.rb @@ -16,7 +16,7 @@ def test_returns_domain_locked_by_registrant_time_or_nil 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(extensionsProhibited: false) serializer_for_locked_domain = Serializers::RegistrantApi::Domain.new(@domain.reload) new_json = serializer_for_locked_domain.to_json diff --git a/test/models/domain/domain_version_test.rb b/test/models/domain/domain_version_test.rb index 2139c21c16..109785fcba 100644 --- a/test/models/domain/domain_version_test.rb +++ b/test/models/domain/domain_version_test.rb @@ -31,7 +31,7 @@ def test_assigns_updator_to_paper_trail_whodunnit PaperTrail.request.whodunnit = @user.id_role_username assert_difference '@domain.versions.count', 1 do - @domain.apply_registry_lock + @domain.apply_registry_lock(extensionsProhibited: false) end assert_equal(@domain.updator, @user) diff --git a/test/models/domain/registry_lockable_test.rb b/test/models/domain/registry_lockable_test.rb index c8ea69fd1a..853d44cc5b 100644 --- a/test/models/domain/registry_lockable_test.rb +++ b/test/models/domain/registry_lockable_test.rb @@ -18,7 +18,7 @@ def test_user_can_set_lock_for_domain_if_it_has_any_prohibited_status end def test_remove_lockalable_statuses_after_admin_intervention - @domain.apply_registry_lock + @domain.apply_registry_lock(extensionsProhibited: false) assert @domain.locked_by_registrant? assert_equal @domain.statuses.sort, Domain::RegistryLockable::LOCK_STATUSES.sort @@ -26,7 +26,7 @@ def test_remove_lockalable_statuses_after_admin_intervention @domain.update(statuses: deleted_status) assert_not @domain.locked_by_registrant? - @domain.apply_registry_lock + @domain.apply_registry_lock(extensionsProhibited: false) assert @domain.locked_by_registrant? @domain.remove_registry_lock @@ -41,7 +41,7 @@ def test_restore_domain_statuses_after_unlock @domain.save assert @domain.admin_store_statuses_history.include? DomainStatus::SERVER_UPDATE_PROHIBITED - @domain.apply_registry_lock + @domain.apply_registry_lock(extensionsProhibited: false) assert @domain.locked_by_registrant? assert_equal @domain.statuses.sort, Domain::RegistryLockable::LOCK_STATUSES.sort @@ -52,7 +52,7 @@ def test_restore_domain_statuses_after_unlock end def test_add_additinal_status_for_locked_domain - @domain.apply_registry_lock + @domain.apply_registry_lock(extensionsProhibited: false) assert @domain.locked_by_registrant? assert_equal @domain.statuses.sort, Domain::RegistryLockable::LOCK_STATUSES.sort @@ -69,7 +69,7 @@ def test_add_additinal_status_for_locked_domain def test_lockable_domain_if_remove_some_prohibited_status refute(@domain.locked_by_registrant?) - @domain.apply_registry_lock + @domain.apply_registry_lock(extensionsProhibited: false) check_statuses_lockable_domain assert(@domain.locked_by_registrant?) @@ -85,7 +85,7 @@ def test_lockable_domain_if_remove_some_prohibited_status def test_registry_lock_on_lockable_domain refute(@domain.locked_by_registrant?) - @domain.apply_registry_lock + @domain.apply_registry_lock(extensionsProhibited: false) assert_equal( [DomainStatus::SERVER_UPDATE_PROHIBITED, @@ -99,21 +99,21 @@ def test_registry_lock_on_lockable_domain end def test_registry_lock_cannot_be_applied_twice - @domain.apply_registry_lock - refute(@domain.apply_registry_lock) + @domain.apply_registry_lock(extensionsProhibited: false) + refute(@domain.apply_registry_lock(extensionsProhibited: 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(extensionsProhibited: 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(extensionsProhibited: false) assert_equal( [DomainStatus::SERVER_UPDATE_PROHIBITED, diff --git a/test/system/admin_area/domains/registry_lock_test.rb b/test/system/admin_area/domains/registry_lock_test.rb index 6a34c23b40..3d002a077f 100644 --- a/test/system/admin_area/domains/registry_lock_test.rb +++ b/test/system/admin_area/domains/registry_lock_test.rb @@ -17,7 +17,7 @@ def test_does_not_have_link_when_domain_is_not_locked end def test_can_remove_registry_lock_from_a_domain - @domain.apply_registry_lock + @domain.apply_registry_lock(extensionsProhibited: false) visit edit_admin_domain_path(@domain) click_link_or_button('Actions') @@ -34,7 +34,7 @@ def test_can_remove_registry_lock_from_a_domain end def test_cannot_remove_registry_lock_from_not_locked_domain - @domain.apply_registry_lock + @domain.apply_registry_lock(extensionsProhibited: false) visit edit_admin_domain_path(@domain) @domain.remove_registry_lock diff --git a/test/system/admin_area/domains_test.rb b/test/system/admin_area/domains_test.rb index 9a59247fe7..52babd99c1 100644 --- a/test/system/admin_area/domains_test.rb +++ b/test/system/admin_area/domains_test.rb @@ -20,7 +20,7 @@ def test_admin_registry_lock_date refute_text 'Registry lock time 2010-07-05 00:30' lockable_domain = domains(:airport) - lockable_domain.apply_registry_lock + lockable_domain.apply_registry_lock(extensionsProhibited: false) visit admin_domain_path(lockable_domain) assert_text 'Registry lock time 2010-07-05 00:30' From 81b476f37fe1981cdf390af304421a71d41b3410 Mon Sep 17 00:00:00 2001 From: olegphenomenon Date: Wed, 22 Sep 2021 10:40:01 +0300 Subject: [PATCH 3/4] updated tests --- .idea/workspace.xml | 181 ------------------ .../registrant_api_registry_locks_test.rb | 2 +- test/models/domain/registry_lockable_test.rb | 2 +- 3 files changed, 2 insertions(+), 183 deletions(-) delete mode 100644 .idea/workspace.xml diff --git a/.idea/workspace.xml b/.idea/workspace.xml deleted file mode 100644 index a7cd52260d..0000000000 --- a/.idea/workspace.xml +++ /dev/null @@ -1,181 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1623134418422 - - - - - - - - - \ No newline at end of file diff --git a/test/integration/api/registrant/registrant_api_registry_locks_test.rb b/test/integration/api/registrant/registrant_api_registry_locks_test.rb index c119425a29..e3c25ee254 100644 --- a/test/integration/api/registrant/registrant_api_registry_locks_test.rb +++ b/test/integration/api/registrant/registrant_api_registry_locks_test.rb @@ -59,7 +59,7 @@ def test_cannot_lock_an_already_locked_domain end def test_can_unlock_a_locked_domain - @domain.apply_registry_lock + @domain.apply_registry_lock(extensionsProhibited: false) delete '/api/v1/registrant/domains/2df2c1a1-8f6a-490a-81be-8bdf29866880/registry_lock', headers: @auth_headers diff --git a/test/models/domain/registry_lockable_test.rb b/test/models/domain/registry_lockable_test.rb index 853d44cc5b..8925ad6004 100644 --- a/test/models/domain/registry_lockable_test.rb +++ b/test/models/domain/registry_lockable_test.rb @@ -11,7 +11,7 @@ def test_user_can_set_lock_for_domain_if_it_has_any_prohibited_status refute(@domain.locked_by_registrant?) @domain.update(statuses: [DomainStatus::SERVER_TRANSFER_PROHIBITED]) - @domain.apply_registry_lock # Raise validation error + @domain.apply_registry_lock(extensionsProhibited: false) # Raise validation error check_statuses_lockable_domain assert(@domain.locked_by_registrant?) From 4d64ee21a1988fd5644226416ab060826e7fd04b Mon Sep 17 00:00:00 2001 From: olegphenomenon Date: Wed, 22 Sep 2021 11:14:12 +0300 Subject: [PATCH 4/4] refactoring --- .gitignore | 1 + .../registrant/registry_locks_controller.rb | 4 +- .../concerns/domain/registry_lockable.rb | 42 +++++++++++-------- app/models/registrant_user.rb | 2 +- .../registrant_api_registry_locks_test.rb | 4 +- test/jobs/domain_update_confirm_job_test.rb | 4 +- .../serializers/registrant_api/domain_test.rb | 2 +- test/models/domain/domain_version_test.rb | 2 +- test/models/domain/registry_lockable_test.rb | 22 +++++----- .../admin_area/domains/registry_lock_test.rb | 4 +- test/system/admin_area/domains_test.rb | 2 +- 11 files changed, 48 insertions(+), 41 deletions(-) diff --git a/.gitignore b/.gitignore index f09a003dcc..3f23f1277b 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ /config/application.yml /config/environments/development.rb /config/deploy.rb +/.idea # Do not commit one. Instead, download the latest from https://github.com/internetee/style-guide. .rubocop.yml diff --git a/app/controllers/api/v1/registrant/registry_locks_controller.rb b/app/controllers/api/v1/registrant/registry_locks_controller.rb index 1efffeb751..5c5b8c803f 100644 --- a/app/controllers/api/v1/registrant/registry_locks_controller.rb +++ b/app/controllers/api/v1/registrant/registry_locks_controller.rb @@ -8,9 +8,9 @@ class RegistryLocksController < ::Api::V1::Registrant::BaseController before_action :authorized_to_manage_locks? def create - extensionsProhibited = params[:extensionsProhibited] + extensions_prohibited = params[:extensionsProhibited] - if @domain.apply_registry_lock(extensionsProhibited: extensionsProhibited.to_s.downcase == "true") + if @domain.apply_registry_lock(extensions_prohibited: extensions_prohibited.to_s.downcase == 'true') render json: serialized_domain(@domain) else render json: { errors: [{ base: ['Domain cannot be locked'] }] }, diff --git a/app/models/concerns/domain/registry_lockable.rb b/app/models/concerns/domain/registry_lockable.rb index 98f1c89176..24c53b7be9 100644 --- a/app/models/concerns/domain/registry_lockable.rb +++ b/app/models/concerns/domain/registry_lockable.rb @@ -12,22 +12,25 @@ module Domain::RegistryLockable end EXTENSIONS_STATUS = [DomainStatus::SERVER_EXTENSION_UPDATE_PROHIBITED].freeze - - def apply_registry_lock(extensionsProhibited:) + def apply_registry_lock(extensions_prohibited:) return unless registry_lockable? return if locked_by_registrant? transaction do - self.statuses |= LOCK_STATUSES - self.statuses |= EXTENSIONS_STATUS if Feature.obj_and_extensions_statuses_enabled? and extensionsProhibited - self.locked_by_registrant_at = Time.zone.now - alert_registrar_lock_changes!(lock: true) - - save! + apply_statuses_locked_statuses(extensions_prohibited: extensions_prohibited) end end + def apply_statuses_locked_statuses(extensions_prohibited:) + self.statuses |= LOCK_STATUSES + self.statuses |= EXTENSIONS_STATUS if Feature.obj_and_extensions_statuses_enabled? && extensions_prohibited + self.locked_by_registrant_at = Time.zone.now + alert_registrar_lock_changes!(lock: true) + + save! + end + def registry_lockable? (statuses & [DomainStatus::PENDING_DELETE_CONFIRMATION, DomainStatus::PENDING_CREATE, DomainStatus::PENDING_UPDATE, @@ -45,18 +48,21 @@ def remove_registry_lock return unless locked_by_registrant? transaction do - LOCK_STATUSES.each do |domain_status| - statuses.delete([domain_status]) - end - - statuses.delete([EXTENSIONS_STATUS]) if statuses.include? EXTENSIONS_STATUS - - self.locked_by_registrant_at = nil - self.statuses = admin_store_statuses_history || [] - alert_registrar_lock_changes!(lock: false) + remove_statuses_from_locked_domain + end + end - save! + def remove_statuses_from_locked_domain + LOCK_STATUSES.each do |domain_status| + statuses.delete([domain_status]) end + + statuses.delete([EXTENSIONS_STATUS]) if statuses.include? EXTENSIONS_STATUS + self.locked_by_registrant_at = nil + self.statuses = admin_store_statuses_history || [] + alert_registrar_lock_changes!(lock: false) + + save! end def alert_registrar_lock_changes!(lock: true) diff --git a/app/models/registrant_user.rb b/app/models/registrant_user.rb index 57a2f58ab9..f7e85c5af5 100644 --- a/app/models/registrant_user.rb +++ b/app/models/registrant_user.rb @@ -23,7 +23,7 @@ def companies(company_register = CompanyRegister::Client.new) company_register.representation_rights(citizen_personal_code: ident, citizen_country_code: country.alpha3) end - + def contacts(representable: true) Contact.registrant_user_contacts(self, representable: representable) end diff --git a/test/integration/api/registrant/registrant_api_registry_locks_test.rb b/test/integration/api/registrant/registrant_api_registry_locks_test.rb index e3c25ee254..3499711a7c 100644 --- a/test/integration/api/registrant/registrant_api_registry_locks_test.rb +++ b/test/integration/api/registrant/registrant_api_registry_locks_test.rb @@ -47,7 +47,7 @@ def test_cannot_lock_a_domain_in_pending_state end def test_cannot_lock_an_already_locked_domain - @domain.apply_registry_lock(extensionsProhibited: false) + @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 @@ def test_cannot_lock_an_already_locked_domain end def test_can_unlock_a_locked_domain - @domain.apply_registry_lock(extensionsProhibited: false) + @domain.apply_registry_lock(extensions_prohibited: false) delete '/api/v1/registrant/domains/2df2c1a1-8f6a-490a-81be-8bdf29866880/registry_lock', headers: @auth_headers diff --git a/test/jobs/domain_update_confirm_job_test.rb b/test/jobs/domain_update_confirm_job_test.rb index 54a144424c..158729ae3c 100644 --- a/test/jobs/domain_update_confirm_job_test.rb +++ b/test/jobs/domain_update_confirm_job_test.rb @@ -22,14 +22,14 @@ def teardown def test_registrant_locked_domain refute @domain.locked_by_registrant? - @domain.apply_registry_lock(extensionsProhibited: false) + @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(extensionsProhibited: false) + @domain.apply_registry_lock(extensions_prohibited: false) assert @domain.locked_by_registrant? @domain.remove_registry_lock refute @domain.locked_by_registrant? diff --git a/test/lib/serializers/registrant_api/domain_test.rb b/test/lib/serializers/registrant_api/domain_test.rb index a207b649f6..535aefc3d4 100644 --- a/test/lib/serializers/registrant_api/domain_test.rb +++ b/test/lib/serializers/registrant_api/domain_test.rb @@ -16,7 +16,7 @@ def test_returns_domain_locked_by_registrant_time_or_nil assert_not(@json[:locked_by_registrant_at]) travel_to Time.zone.parse('2010-07-05 10:30') - @domain.apply_registry_lock(extensionsProhibited: false) + @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 diff --git a/test/models/domain/domain_version_test.rb b/test/models/domain/domain_version_test.rb index 109785fcba..4b937e274d 100644 --- a/test/models/domain/domain_version_test.rb +++ b/test/models/domain/domain_version_test.rb @@ -31,7 +31,7 @@ def test_assigns_updator_to_paper_trail_whodunnit PaperTrail.request.whodunnit = @user.id_role_username assert_difference '@domain.versions.count', 1 do - @domain.apply_registry_lock(extensionsProhibited: false) + @domain.apply_registry_lock(extensions_prohibited: false) end assert_equal(@domain.updator, @user) diff --git a/test/models/domain/registry_lockable_test.rb b/test/models/domain/registry_lockable_test.rb index 8925ad6004..136c05fbac 100644 --- a/test/models/domain/registry_lockable_test.rb +++ b/test/models/domain/registry_lockable_test.rb @@ -11,14 +11,14 @@ def test_user_can_set_lock_for_domain_if_it_has_any_prohibited_status refute(@domain.locked_by_registrant?) @domain.update(statuses: [DomainStatus::SERVER_TRANSFER_PROHIBITED]) - @domain.apply_registry_lock(extensionsProhibited: false) # 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(extensionsProhibited: false) + @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 @@ def test_remove_lockalable_statuses_after_admin_intervention @domain.update(statuses: deleted_status) assert_not @domain.locked_by_registrant? - @domain.apply_registry_lock(extensionsProhibited: false) + @domain.apply_registry_lock(extensions_prohibited: false) assert @domain.locked_by_registrant? @domain.remove_registry_lock @@ -41,7 +41,7 @@ def test_restore_domain_statuses_after_unlock @domain.save assert @domain.admin_store_statuses_history.include? DomainStatus::SERVER_UPDATE_PROHIBITED - @domain.apply_registry_lock(extensionsProhibited: false) + @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 @@ def test_restore_domain_statuses_after_unlock end def test_add_additinal_status_for_locked_domain - @domain.apply_registry_lock(extensionsProhibited: false) + @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 @@ def test_add_additinal_status_for_locked_domain def test_lockable_domain_if_remove_some_prohibited_status refute(@domain.locked_by_registrant?) - @domain.apply_registry_lock(extensionsProhibited: false) + @domain.apply_registry_lock(extensions_prohibited: false) check_statuses_lockable_domain assert(@domain.locked_by_registrant?) @@ -85,7 +85,7 @@ def test_lockable_domain_if_remove_some_prohibited_status def test_registry_lock_on_lockable_domain refute(@domain.locked_by_registrant?) - @domain.apply_registry_lock(extensionsProhibited: false) + @domain.apply_registry_lock(extensions_prohibited: false) assert_equal( [DomainStatus::SERVER_UPDATE_PROHIBITED, @@ -99,21 +99,21 @@ def test_registry_lock_on_lockable_domain end def test_registry_lock_cannot_be_applied_twice - @domain.apply_registry_lock(extensionsProhibited: false) - refute(@domain.apply_registry_lock(extensionsProhibited: false)) + @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(extensionsProhibited: false)) + 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(extensionsProhibited: false) + @domain.apply_registry_lock(extensions_prohibited: false) assert_equal( [DomainStatus::SERVER_UPDATE_PROHIBITED, diff --git a/test/system/admin_area/domains/registry_lock_test.rb b/test/system/admin_area/domains/registry_lock_test.rb index 3d002a077f..659e1fc7dc 100644 --- a/test/system/admin_area/domains/registry_lock_test.rb +++ b/test/system/admin_area/domains/registry_lock_test.rb @@ -17,7 +17,7 @@ def test_does_not_have_link_when_domain_is_not_locked end def test_can_remove_registry_lock_from_a_domain - @domain.apply_registry_lock(extensionsProhibited: false) + @domain.apply_registry_lock(extensions_prohibited: false) visit edit_admin_domain_path(@domain) click_link_or_button('Actions') @@ -34,7 +34,7 @@ def test_can_remove_registry_lock_from_a_domain end def test_cannot_remove_registry_lock_from_not_locked_domain - @domain.apply_registry_lock(extensionsProhibited: false) + @domain.apply_registry_lock(extensions_prohibited: false) visit edit_admin_domain_path(@domain) @domain.remove_registry_lock diff --git a/test/system/admin_area/domains_test.rb b/test/system/admin_area/domains_test.rb index 52babd99c1..0fabb0e773 100644 --- a/test/system/admin_area/domains_test.rb +++ b/test/system/admin_area/domains_test.rb @@ -20,7 +20,7 @@ def test_admin_registry_lock_date refute_text 'Registry lock time 2010-07-05 00:30' lockable_domain = domains(:airport) - lockable_domain.apply_registry_lock(extensionsProhibited: false) + lockable_domain.apply_registry_lock(extensions_prohibited: false) visit admin_domain_path(lockable_domain) assert_text 'Registry lock time 2010-07-05 00:30'