mirror of
https://github.com/internetee/registry.git
synced 2025-07-22 10:45:58 +02:00
Add tests for admin bounced mails views
This commit is contained in:
parent
64308e1104
commit
101d5d4a78
5 changed files with 82 additions and 15 deletions
|
@ -26,15 +26,5 @@ module Admin
|
||||||
def set_bounced_mail_address
|
def set_bounced_mail_address
|
||||||
@bounced_mail_address = BouncedMailAddress.find(params[:id])
|
@bounced_mail_address = BouncedMailAddress.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
# Only allow a trusted parameter "white list" through.
|
|
||||||
def bounced_mail_address_params
|
|
||||||
params.require(:bounced_mail_address).permit(
|
|
||||||
:email,
|
|
||||||
:bounce_reason,
|
|
||||||
:incidents,
|
|
||||||
:response_json
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
<p id="notice"><%= notice %></p>
|
|
||||||
|
|
||||||
<h1>Bounced Mail Addresses</h1>
|
<h1>Bounced Mail Addresses</h1>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
<p id="notice"><%= notice %></p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<strong>Email:</strong>
|
<strong>Email:</strong>
|
||||||
<%= @bounced_mail_address.email %>
|
<%= @bounced_mail_address.email %>
|
||||||
</p>
|
</p>
|
||||||
|
@ -26,3 +23,4 @@
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<%= link_to 'Back', admin_bounced_mail_addresses_path %>
|
<%= link_to 'Back', admin_bounced_mail_addresses_path %>
|
||||||
|
<%= link_to 'Destroy', admin_bounced_mail_address_path(@bounced_mail_address), method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||||
|
|
40
test/fixtures/bounced_mail_addresses.yml
vendored
Normal file
40
test/fixtures/bounced_mail_addresses.yml
vendored
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
one:
|
||||||
|
email: bounced@registry.test
|
||||||
|
bounce_reason: failed (5.1.1 smtp; 550 5.1.1 user unknown)
|
||||||
|
incidents: 1
|
||||||
|
recipient_json: {
|
||||||
|
"action": "failed",
|
||||||
|
"status": "5.1.1",
|
||||||
|
"emailAddress": "bounced@registry.test",
|
||||||
|
"diagnosticCode": "smtp; 550 5.1.1 user unknown"
|
||||||
|
}
|
||||||
|
response_json: {
|
||||||
|
"notificationType": "Bounce",
|
||||||
|
"mail": {
|
||||||
|
"source": "noreply@registry.test",
|
||||||
|
"sourceIp": "195.43.86.5",
|
||||||
|
"messageId": "010f0174a0c7d348-ea6e2fc1-0854-4073-b71f-5cecf9b0d0b2-000000",
|
||||||
|
"sourceArn": "arn:aws:ses:us-east-2:65026820000:identity/noreply@registry.test",
|
||||||
|
"timestamp": "2020-09-18T10:34:44.000Z",
|
||||||
|
"destination": [ "bounced@registry.test" ],
|
||||||
|
"sendingAccountId": "650268220000"
|
||||||
|
},
|
||||||
|
"bounce": {
|
||||||
|
"timestamp": "2020-09-18T10:34:44.911Z",
|
||||||
|
"bounceType": "Permanent",
|
||||||
|
"feedbackId": "010f0174a0c7d4f9-27d59756-6111-4d5f-xxxx-26bee0d55fa2-000000",
|
||||||
|
"remoteMtaIp": "127.0.01",
|
||||||
|
"reportingMTA": "dsn; xxx.amazonses.com",
|
||||||
|
"bounceSubType": "General",
|
||||||
|
"bouncedRecipients": [
|
||||||
|
{
|
||||||
|
"action": "failed",
|
||||||
|
"status": "5.1.1",
|
||||||
|
"emailAddress": "bounced@registry.test",
|
||||||
|
"diagnosticCode": "smtp; 550 5.1.1 user unknown"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
created_at: <%= Time.zone.parse('2010-07-05').to_s(:db) %>
|
||||||
|
updated_at: <%= Time.zone.parse('2010-07-05').to_s(:db) %>
|
41
test/system/admin_area/bounced_mail_addresses_test.rb
Normal file
41
test/system/admin_area/bounced_mail_addresses_test.rb
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
require 'application_system_test_case'
|
||||||
|
|
||||||
|
class AdminBouncedMailAddressesTest < ApplicationSystemTestCase
|
||||||
|
include ActionView::Helpers::NumberHelper
|
||||||
|
|
||||||
|
def setup
|
||||||
|
@bounced_mail = bounced_mail_addresses(:one)
|
||||||
|
@original_default_language = Setting.default_language
|
||||||
|
sign_in users(:admin)
|
||||||
|
end
|
||||||
|
|
||||||
|
def teardown
|
||||||
|
Setting.default_language = @original_default_language
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_shows_bounced_emails
|
||||||
|
visit admin_bounced_mail_addresses_path
|
||||||
|
assert_text @bounced_mail.status
|
||||||
|
assert_text @bounced_mail.action
|
||||||
|
assert_text @bounced_mail.diagnostic
|
||||||
|
assert_text @bounced_mail.email
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_shows_detailed_bounced_email
|
||||||
|
visit admin_bounced_mail_address_path(@bounced_mail)
|
||||||
|
assert_text @bounced_mail.status
|
||||||
|
assert_text @bounced_mail.action
|
||||||
|
assert_text @bounced_mail.diagnostic
|
||||||
|
assert_text @bounced_mail.email
|
||||||
|
|
||||||
|
assert_text 'bouncedRecipients'
|
||||||
|
assert_text '010f0174a0c7d4f9-27d59756-6111-4d5f-xxxx-26bee0d55fa2-000000'
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_deletes_registrar
|
||||||
|
visit admin_bounced_mail_address_path(@bounced_mail)
|
||||||
|
click_on 'Destroy'
|
||||||
|
|
||||||
|
assert_text 'Bounced mail address was successfully destroyed.'
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Add a link
Reference in a new issue