Merge branch 'master' into 2080-implement-new-field-for-store-statuses-in-domain-model

This commit is contained in:
Alex Sherman 2021-07-14 14:51:58 +05:00 committed by Oleg Hasjanov
commit d047561bdc
6 changed files with 81 additions and 6 deletions

View file

@ -588,6 +588,50 @@ class EppDomainUpdateBaseTest < EppTestCase
assert_no_emails
end
def test_makes_update_if_was_forcedelete
contact = @domain.contacts.first
contact.update_attribute(:email, '`@outlook.test')
contact.email_verification.verify
assert contact.email_verification_failed?
@domain.reload
assert @domain.force_delete_scheduled?
@domain.update_attribute(:statuses_before_force_delete, nil)
Setting.request_confirmation_on_registrant_change_enabled = true
new_registrant = contacts(:william).becomes(Registrant)
assert_not_equal new_registrant, @domain.registrant
request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee', for_version: '1.0')}">
<command>
<update>
<domain:update xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee', for_version: '1.1')}">
<domain:name>#{@domain.name}</domain:name>
<domain:chg>
<domain:registrant verified="yes">#{new_registrant.code}</domain:registrant>
</domain:chg>
</domain:update>
</update>
<extension>
<eis:extdata xmlns:eis="#{Xsd::Schema.filename(for_prefix: 'eis', for_version: '1.0')}">
<eis:legalDocument type="pdf">#{'test' * 2000}</eis:legalDocument>
</eis:extdata>
</extension>
</command>
</epp>
XML
post epp_update_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
@domain.reload
response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :completed_successfully
end
def test_clears_force_delete_when_registrar_changed
Setting.request_confirmation_on_registrant_change_enabled = true
new_registrant = contacts(:william).becomes(Registrant)

View file

@ -26,6 +26,31 @@ class EppPollTest < EppTestCase
assert_equal 'Your domain has been updated', xml_doc.at_css('msgQ msg').text
end
def test_clears_orphan_messages_if_any
# To check if we are clearing orphan messages we need to create a message not linked to any
# existing Epp::Domain
orphan_notification = @notification.dup
orphan_notification.attached_obj_type = Epp::Domain
orphan_notification.attached_obj_id = rand(Epp::Domain.first.id-1)
orphan_notification.save!
assert orphan_notification.unread?
request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee', for_version: '1.0')}">
<command>
<poll op="req"/>
</command>
</epp>
XML
post epp_poll_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
orphan_notification.reload
refute orphan_notification.unread?
end
def test_does_not_drop_error_if_old_version
version = Version::DomainVersion.last
@notification.update(attached_obj_type: 'DomainVersion', attached_obj_id: version.id)