mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-06 11:23:48 -05:00
Merge pull request #905 from GSA/notify-api-522
Add carrier to downloadable reports
This commit is contained in:
@@ -63,6 +63,7 @@ def generate_notifications_csv(**kwargs):
|
||||
from app import notification_api_client
|
||||
from app.s3_client.s3_csv_client import s3download
|
||||
|
||||
current_app.logger.info("\n\n\n\nENTER generate_notifications_csv")
|
||||
if "page" not in kwargs:
|
||||
kwargs["page"] = 1
|
||||
|
||||
@@ -76,7 +77,16 @@ def generate_notifications_csv(**kwargs):
|
||||
fieldnames = (
|
||||
["Row number"]
|
||||
+ original_column_headers
|
||||
+ ["Template", "Type", "Sent by", "Job", "Status", "Time"]
|
||||
+ [
|
||||
"Template",
|
||||
"Type",
|
||||
"Sent by",
|
||||
"Job",
|
||||
"Carrier",
|
||||
"Carrier Response",
|
||||
"Status",
|
||||
"Time",
|
||||
]
|
||||
)
|
||||
else:
|
||||
fieldnames = [
|
||||
@@ -85,6 +95,8 @@ def generate_notifications_csv(**kwargs):
|
||||
"Type",
|
||||
"Sent by",
|
||||
"Job",
|
||||
"Carrier",
|
||||
"Carrier Response",
|
||||
"Status",
|
||||
"Time",
|
||||
]
|
||||
@@ -96,7 +108,7 @@ def generate_notifications_csv(**kwargs):
|
||||
**kwargs
|
||||
)
|
||||
for notification in notifications_resp["notifications"]:
|
||||
current_app.logger.info(notification)
|
||||
current_app.logger.info(f"\n\n{notification}")
|
||||
if kwargs.get("job_id"):
|
||||
values = (
|
||||
[
|
||||
@@ -111,6 +123,8 @@ def generate_notifications_csv(**kwargs):
|
||||
notification["template_type"],
|
||||
notification["created_by_name"],
|
||||
notification["job_name"],
|
||||
notification["carrier"],
|
||||
notification["provider_response"],
|
||||
notification["status"],
|
||||
notification["created_at"],
|
||||
]
|
||||
@@ -122,6 +136,8 @@ def generate_notifications_csv(**kwargs):
|
||||
notification["template_type"],
|
||||
notification["created_by_name"] or "",
|
||||
notification["job_name"] or "",
|
||||
notification["carrier"],
|
||||
notification["provider_response"],
|
||||
notification["status"],
|
||||
notification["created_at"],
|
||||
]
|
||||
|
||||
@@ -14,6 +14,8 @@ def _get_notifications_csv(
|
||||
template_name="foo",
|
||||
template_type="sms",
|
||||
job_name="bar.csv",
|
||||
carrier="ATT Mobility",
|
||||
provider_response="Did not like it",
|
||||
status="Delivered",
|
||||
created_at="1943-04-19 12:00:00",
|
||||
rows=1,
|
||||
@@ -47,6 +49,8 @@ def _get_notifications_csv(
|
||||
"template_type": template_type,
|
||||
"template": {"name": template_name, "template_type": template_type},
|
||||
"job_name": job_name,
|
||||
"carrier": carrier,
|
||||
"provider_response": provider_response,
|
||||
"status": status,
|
||||
"created_at": created_at,
|
||||
"updated_at": None,
|
||||
@@ -82,15 +86,15 @@ def get_notifications_csv_mock(
|
||||
(
|
||||
None,
|
||||
[
|
||||
"Recipient,Template,Type,Sent by,Job,Status,Time\n",
|
||||
"foo@bar.com,foo,sms,,,Delivered,1943-04-19 12:00:00\r\n",
|
||||
"Recipient,Template,Type,Sent by,Job,Carrier,Carrier Response,Status,Time\n",
|
||||
"foo@bar.com,foo,sms,,,ATT Mobility,Did not like it,Delivered,1943-04-19 12:00:00\r\n",
|
||||
],
|
||||
),
|
||||
(
|
||||
"Anne Example",
|
||||
[
|
||||
"Recipient,Template,Type,Sent by,Job,Status,Time\n",
|
||||
"foo@bar.com,foo,sms,Anne Example,,Delivered,1943-04-19 12:00:00\r\n",
|
||||
"Recipient,Template,Type,Sent by,Job,Carrier,Carrier Response,Status,Time\n",
|
||||
"foo@bar.com,foo,sms,Anne Example,,ATT Mobility,Did not like it,Delivered,1943-04-19 12:00:00\r\n",
|
||||
],
|
||||
),
|
||||
],
|
||||
@@ -128,6 +132,8 @@ def test_generate_notifications_csv_without_job(
|
||||
"Type",
|
||||
"Sent by",
|
||||
"Job",
|
||||
"Carrier",
|
||||
"Carrier Response",
|
||||
"Status",
|
||||
"Time",
|
||||
],
|
||||
@@ -138,6 +144,8 @@ def test_generate_notifications_csv_without_job(
|
||||
"sms",
|
||||
"Fake Person",
|
||||
"bar.csv",
|
||||
"ATT Mobility",
|
||||
"Did not like it",
|
||||
"Delivered",
|
||||
"1943-04-19 12:00:00",
|
||||
],
|
||||
@@ -157,6 +165,8 @@ def test_generate_notifications_csv_without_job(
|
||||
"Type",
|
||||
"Sent by",
|
||||
"Job",
|
||||
"Carrier",
|
||||
"Carrier Response",
|
||||
"Status",
|
||||
"Time",
|
||||
],
|
||||
@@ -170,6 +180,8 @@ def test_generate_notifications_csv_without_job(
|
||||
"sms",
|
||||
"Fake Person",
|
||||
"bar.csv",
|
||||
"ATT Mobility",
|
||||
"Did not like it",
|
||||
"Delivered",
|
||||
"1943-04-19 12:00:00",
|
||||
],
|
||||
@@ -189,6 +201,8 @@ def test_generate_notifications_csv_without_job(
|
||||
"Type",
|
||||
"Sent by",
|
||||
"Job",
|
||||
"Carrier",
|
||||
"Carrier Response",
|
||||
"Status",
|
||||
"Time",
|
||||
],
|
||||
@@ -202,6 +216,8 @@ def test_generate_notifications_csv_without_job(
|
||||
"sms",
|
||||
"Fake Person",
|
||||
"bar.csv",
|
||||
"ATT Mobility",
|
||||
"Did not like it",
|
||||
"Delivered",
|
||||
"1943-04-19 12:00:00",
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user