mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-28 03:39:29 -04:00
When someone complains about an email from the platform we get a callback from SES.
A new platform admin page Email complaints has been added to surface those complaints. Eventually the complaints will be visible to the services so they can remove the email address from their mailing list. Next thing to implement is "x email complaints" warning on the platform admin summary page.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import datetime
|
||||
import uuid
|
||||
from unittest.mock import ANY
|
||||
|
||||
import pytest
|
||||
@@ -637,3 +638,32 @@ def test_sum_service_usage_with_zeros(fake_uuid):
|
||||
sms_failed=0
|
||||
)
|
||||
assert sum_service_usage(service) == 0
|
||||
|
||||
|
||||
def test_platform_admin_list_complaints(
|
||||
client,
|
||||
platform_admin_user,
|
||||
mocker
|
||||
):
|
||||
mock_get_user(mocker, user=platform_admin_user)
|
||||
client.login(platform_admin_user)
|
||||
complaint = {
|
||||
'id': str(uuid.uuid4()),
|
||||
'notification_id': str(uuid.uuid4()),
|
||||
'service_id': str(uuid.uuid4()),
|
||||
'service_name': 'Sample service',
|
||||
'ses_feedback_id': 'Some ses id',
|
||||
'complaint_type': 'abuse',
|
||||
'complaint_date': '2018-06-05T13:50:30.012354',
|
||||
'created_at': '2018-06-05T13:50:30.012354',
|
||||
}
|
||||
mock = mocker.patch('app.complaint_api_client.get_all_complaints',
|
||||
return_value=[complaint])
|
||||
|
||||
client.login(platform_admin_user)
|
||||
response = client.get(url_for('main.platform_admin_list_complaints'))
|
||||
|
||||
assert response.status_code == 200
|
||||
resp_data = response.get_data(as_text=True)
|
||||
assert 'Email complaints' in resp_data
|
||||
mock.assert_called_once()
|
||||
|
||||
10
tests/app/notify_client/test_compliant_client.py
Normal file
10
tests/app/notify_client/test_compliant_client.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from app import ComplaintApiClient
|
||||
|
||||
|
||||
def test_get_all_complaints(mocker):
|
||||
client = ComplaintApiClient()
|
||||
|
||||
mock = mocker.patch('app.notify_client.complaint_api_client.ComplaintApiClient.get')
|
||||
|
||||
client.get_all_complaints()
|
||||
mock.assert_called_once_with('/complaint')
|
||||
Reference in New Issue
Block a user