mirror of
https://github.com/internetee/registry.git
synced 2025-06-10 14:44:47 +02:00
Merge pull request #1735 from internetee/1178-invalid-email-fd-template
Add invalid email template to ForceDelete notifications
This commit is contained in:
commit
5e6fb351ab
11 changed files with 148 additions and 40 deletions
|
@ -5,10 +5,6 @@ class DomainDeleteMailerTest < ActionMailer::TestCase
|
|||
@domain = domains(:shop)
|
||||
end
|
||||
|
||||
def test_force_delete_templates
|
||||
assert_equal %w[private_person legal_person], DomainDeleteMailer.force_delete_templates
|
||||
end
|
||||
|
||||
def test_delivers_confirmation_request_email
|
||||
assert_equal 'shop.test', @domain.name
|
||||
assert_equal 'john@inbox.test', @domain.registrant.email
|
||||
|
@ -68,8 +64,7 @@ class DomainDeleteMailerTest < ActionMailer::TestCase
|
|||
email = DomainDeleteMailer.forced(domain: @domain,
|
||||
registrar: @domain.registrar,
|
||||
registrant: @domain.registrant,
|
||||
template_name: DomainDeleteMailer.force_delete_templates
|
||||
.first).deliver_now
|
||||
template_name: @domain.notification_template).deliver_now
|
||||
|
||||
assert_emails 1
|
||||
assert_equal ['legal@registry.test'], email.from
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
class DomainDeleteMailerPreview < ActionMailer::Preview
|
||||
def self.define_forced_templates
|
||||
DomainDeleteMailer.force_delete_templates.each do |template_name|
|
||||
%w[private_person legal_person invalid_email].each do |template_name|
|
||||
define_method "forced_#{template_name}".to_sym do
|
||||
DomainDeleteMailer.forced(domain: @domain,
|
||||
registrar: @domain.registrar,
|
||||
registrant: @domain.registrant,
|
||||
domain = Domain.first
|
||||
DomainDeleteMailer.forced(domain: domain,
|
||||
registrar: domain.registrar,
|
||||
registrant: domain.registrant,
|
||||
template_name: template_name)
|
||||
end
|
||||
end
|
||||
|
@ -12,26 +13,25 @@ class DomainDeleteMailerPreview < ActionMailer::Preview
|
|||
|
||||
define_forced_templates
|
||||
|
||||
def initialize
|
||||
@domain = Domain.first
|
||||
super
|
||||
end
|
||||
|
||||
def confirmation_request
|
||||
DomainDeleteMailer.confirmation_request(domain: @domain,
|
||||
registrar: @domain.registrar,
|
||||
registrant: @domain.registrant)
|
||||
domain = Domain.first
|
||||
DomainDeleteMailer.confirmation_request(domain: domain,
|
||||
registrar: domain.registrar,
|
||||
registrant: domain.registrant)
|
||||
end
|
||||
|
||||
def accepted
|
||||
DomainDeleteMailer.accepted(@domain)
|
||||
domain = Domain.first
|
||||
DomainDeleteMailer.accepted(domain)
|
||||
end
|
||||
|
||||
def rejected
|
||||
DomainDeleteMailer.rejected(@domain)
|
||||
domain = Domain.first
|
||||
DomainDeleteMailer.rejected(domain)
|
||||
end
|
||||
|
||||
def expired
|
||||
DomainDeleteMailer.expired(@domain)
|
||||
domain = Domain.first
|
||||
DomainDeleteMailer.expired(domain)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -44,7 +44,7 @@ class AdminAreaDomainForceDeleteTest < ApplicationSystemTestCase
|
|||
end
|
||||
|
||||
@domain.reload
|
||||
assert_equal template_name, @domain.template_name
|
||||
assert_equal @domain.notification_template, @domain.template_name
|
||||
end
|
||||
|
||||
def test_uses_legal_template_if_registrant_org
|
||||
|
@ -57,7 +57,23 @@ class AdminAreaDomainForceDeleteTest < ApplicationSystemTestCase
|
|||
end
|
||||
|
||||
@domain.reload
|
||||
assert_equal template_name, @domain.template_name
|
||||
assert_equal @domain.notification_template, @domain.template_name
|
||||
end
|
||||
|
||||
def test_uses_legal_template_if_invalid_email
|
||||
verification = @domain.contacts.first.email_verification
|
||||
verification.update(verified_at: Time.zone.now - 1.day, success: false)
|
||||
|
||||
assert_equal @domain.notification_template, 'invalid_email'
|
||||
|
||||
assert_emails 0 do
|
||||
visit edit_admin_domain_url(@domain)
|
||||
find(:css, '#soft_delete').set(true)
|
||||
click_link_or_button 'Force delete domain'
|
||||
end
|
||||
|
||||
@domain.reload
|
||||
assert_equal @domain.notification_template, @domain.template_name
|
||||
end
|
||||
|
||||
def test_allows_to_skip_notifying_registrant_and_admin_contacts_by_email
|
||||
|
@ -87,10 +103,4 @@ class AdminAreaDomainForceDeleteTest < ApplicationSystemTestCase
|
|||
assert_no_button 'Schedule force delete'
|
||||
assert_no_link 'Schedule force delete'
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def template_name
|
||||
@domain.registrant.org? ? 'legal_person' : 'private_person'
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue