Add non-mandatory legal docs to domain transfer/delete

This commit is contained in:
Alex Sherman 2020-07-01 13:59:10 +05:00
parent d29ef4174c
commit 60ad331903
3 changed files with 95 additions and 5 deletions

View file

@ -160,10 +160,8 @@ class EppDomainDeleteBaseTest < EppTestCase
assert_epp_response :completed_successfully
end
def test_legal_document_is_required
def test_legal_document_is_required_if_mandatory
assert_equal 'shop.test', @domain.name
@domain.registrar.legaldoc_optout = true
@domain.registrar.save(validate: false)
request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
@ -183,6 +181,35 @@ class EppDomainDeleteBaseTest < EppTestCase
assert_epp_response :required_parameter_missing
end
def test_legal_document_is_not_required_if_not_mandatory
assert_equal 'shop.test', @domain.name
Setting.request_confirmation_on_domain_deletion_enabled = true
@domain.registrar.legaldoc_optout = true
@domain.registrar.save(validate: false)
@domain.registrar.reload
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>
<delete>
<domain:delete verified="yes" xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
<domain:name>shop.test</domain:name>
</domain:delete>
</delete>
</command>
</epp>
XML
post epp_delete_path, params: { frame: request_xml }, headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
@domain.reload
assert_not @domain.registrant_verification_asked?
assert_not @domain.pending_delete_confirmation?
assert_no_emails
assert_epp_response :completed_successfully
end
def test_domain_cannot_be_deleted_when_explicitly_prohibited_by_registrar
assert_equal 'shop.test', @domain.name
@domain.update!(statuses: [DomainStatus::CLIENT_DELETE_PROHIBITED])