Merge pull request #2375 from internetee/2374-deprecated-validation-events

Prevent deprecated validation events
This commit is contained in:
Timo Võhmar 2022-05-17 13:58:12 +03:00 committed by GitHub
commit a580c22d71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 52 additions and 30 deletions

View file

@ -80,6 +80,35 @@ class EppContactUpdateBaseTest < EppTestCase
assert_emails 1
end
def test_destroy_old_validation_when_email_is_changed
@contact.verify_email
old_validation_event = @contact.validation_events.first
@contact.update_columns(code: @contact.code.upcase)
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>
<contact:update xmlns:contact="#{Xsd::Schema.filename(for_prefix: 'contact-ee', for_version: '1.1')}">
<contact:id>john-001</contact:id>
<contact:chg>
<contact:email>john-new@inbox.test</contact:email>
</contact:chg>
</contact:update>
</update>
</command>
</epp>
XML
post epp_update_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
assert_raises(ActiveRecord::RecordNotFound) do
ValidationEvent.find(old_validation_event.id)
end
end
def test_skips_notifying_contact_when_email_is_not_changed
assert_equal 'john-001', @contact.code
assert_equal 'john@inbox.test', @contact.email