mirror of
https://github.com/internetee/registry.git
synced 2025-06-06 20:55:44 +02:00
Flush settings cache on legal doc mandatority check
This commit is contained in:
parent
a80e813632
commit
4a2176d5d7
6 changed files with 63 additions and 2 deletions
|
@ -20,6 +20,7 @@ before_script:
|
||||||
- "echo \"ca_key_password: 'password'\" >> config/application.yml"
|
- "echo \"ca_key_password: 'password'\" >> config/application.yml"
|
||||||
- "cp config/database_travis.yml config/database.yml"
|
- "cp config/database_travis.yml config/database.yml"
|
||||||
- "bundle exec rake db:setup:all"
|
- "bundle exec rake db:setup:all"
|
||||||
|
- "bundle exec rake data:migrate"
|
||||||
- "curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter"
|
- "curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter"
|
||||||
- "chmod +x ./cc-test-reporter"
|
- "chmod +x ./cc-test-reporter"
|
||||||
- "./cc-test-reporter before-build"
|
- "./cc-test-reporter before-build"
|
||||||
|
|
|
@ -8,7 +8,8 @@ module Concerns
|
||||||
end
|
end
|
||||||
|
|
||||||
def legaldoc_not_mandatory?
|
def legaldoc_not_mandatory?
|
||||||
legaldoc_optout || !Setting.legal_document_is_mandatory
|
setting = Setting.find_by(var: 'legal_document_is_mandatory')&.value
|
||||||
|
legaldoc_optout || !setting
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
class AddLegalDocumentMandatorySetting < ActiveRecord::Migration[6.0]
|
||||||
|
def up
|
||||||
|
Setting.legal_document_is_mandatory = true
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
Setting.find_by(var: 'legal_document_is_mandatory').delete
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,2 +1,2 @@
|
||||||
# encoding: UTF-8
|
# encoding: UTF-8
|
||||||
DataMigrate::Data.define(version: 20150707103801)
|
DataMigrate::Data.define(version: 20200702104334)
|
||||||
|
|
|
@ -3,6 +3,8 @@ require 'test_helper'
|
||||||
class EppDomainCreateBaseTest < EppTestCase
|
class EppDomainCreateBaseTest < EppTestCase
|
||||||
|
|
||||||
def test_not_registers_domain_without_legaldoc
|
def test_not_registers_domain_without_legaldoc
|
||||||
|
old_value = Setting.legal_document_is_mandatory
|
||||||
|
Setting.legal_document_is_mandatory = true
|
||||||
now = Time.zone.parse('2010-07-05')
|
now = Time.zone.parse('2010-07-05')
|
||||||
travel_to now
|
travel_to now
|
||||||
name = "new.#{dns_zones(:one).origin}"
|
name = "new.#{dns_zones(:one).origin}"
|
||||||
|
@ -29,6 +31,7 @@ class EppDomainCreateBaseTest < EppTestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_epp_response :required_parameter_missing
|
assert_epp_response :required_parameter_missing
|
||||||
|
Setting.legal_document_is_mandatory = old_value
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_registers_new_domain_with_required_attributes
|
def test_registers_new_domain_with_required_attributes
|
||||||
|
@ -112,6 +115,50 @@ class EppDomainCreateBaseTest < EppTestCase
|
||||||
assert_equal registrant, domain.registrant
|
assert_equal registrant, domain.registrant
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_does_not_registers_domain_without_legaldoc_if_mandatory
|
||||||
|
now = Time.zone.parse('2010-07-05')
|
||||||
|
travel_to now
|
||||||
|
name = "new.#{dns_zones(:one).origin}"
|
||||||
|
contact = contacts(:john)
|
||||||
|
registrant = contact.becomes(Registrant)
|
||||||
|
old_value = Setting.legal_document_is_mandatory
|
||||||
|
Setting.legal_document_is_mandatory = true
|
||||||
|
registrar = registrant.registrar
|
||||||
|
|
||||||
|
assert registrar.legaldoc_mandatory?
|
||||||
|
|
||||||
|
request_xml = <<-XML
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
||||||
|
<command>
|
||||||
|
<create>
|
||||||
|
<domain:create xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
|
||||||
|
<domain:name>#{name}</domain:name>
|
||||||
|
<domain:registrant>#{registrant.code}</domain:registrant>
|
||||||
|
</domain:create>
|
||||||
|
</create>
|
||||||
|
</command>
|
||||||
|
</epp>
|
||||||
|
XML
|
||||||
|
|
||||||
|
|
||||||
|
post epp_create_path, params: { frame: request_xml },
|
||||||
|
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||||
|
|
||||||
|
assert_epp_response :required_parameter_missing
|
||||||
|
Setting.legal_document_is_mandatory = false
|
||||||
|
|
||||||
|
assert_not registrar.legaldoc_mandatory?
|
||||||
|
assert_not Setting.legal_document_is_mandatory
|
||||||
|
|
||||||
|
assert_difference 'Domain.count' do
|
||||||
|
post epp_create_path, params: { frame: request_xml },
|
||||||
|
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||||
|
end
|
||||||
|
|
||||||
|
Setting.legal_document_is_mandatory = old_value
|
||||||
|
end
|
||||||
|
|
||||||
def test_registers_reserved_domain_with_registration_code
|
def test_registers_reserved_domain_with_registration_code
|
||||||
reserved_domain = reserved_domains(:one)
|
reserved_domain = reserved_domains(:one)
|
||||||
registration_code = reserved_domain.registration_code
|
registration_code = reserved_domain.registration_code
|
||||||
|
|
|
@ -198,6 +198,8 @@ class EppDomainUpdateBaseTest < EppTestCase
|
||||||
|
|
||||||
def test_dows_not_update_registrant_when_legaldoc_is_mandatory
|
def test_dows_not_update_registrant_when_legaldoc_is_mandatory
|
||||||
Setting.request_confrimation_on_registrant_change_enabled = true
|
Setting.request_confrimation_on_registrant_change_enabled = true
|
||||||
|
old_value = Setting.legal_document_is_mandatory
|
||||||
|
Setting.legal_document_is_mandatory = true
|
||||||
new_registrant = contacts(:william)
|
new_registrant = contacts(:william)
|
||||||
assert_not_equal new_registrant, @domain.registrant
|
assert_not_equal new_registrant, @domain.registrant
|
||||||
|
|
||||||
|
@ -220,6 +222,7 @@ class EppDomainUpdateBaseTest < EppTestCase
|
||||||
post epp_update_path, params: { frame: request_xml },
|
post epp_update_path, params: { frame: request_xml },
|
||||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||||
assert_epp_response :required_parameter_missing
|
assert_epp_response :required_parameter_missing
|
||||||
|
Setting.legal_document_is_mandatory = old_value
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_skips_verification_when_provided_registrant_is_the_same_as_current_one
|
def test_skips_verification_when_provided_registrant_is_the_same_as_current_one
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue