Add formatted notification status to CSV

This commit makes the CSV download use the same language for failure
reasons as the frontend.

It also adds a test around this stuff, which was patchily tested before.
This commit is contained in:
Chris Hill-Scott
2016-07-11 10:49:01 +01:00
parent f9a9048579
commit 50c20ce680
5 changed files with 92 additions and 24 deletions

View File

@@ -89,7 +89,7 @@ def get_errors_for_csv(recipients, template_type):
def generate_notifications_csv(json_list):
from app import format_datetime
from app import format_datetime, format_notification_status
content = StringIO()
retval = None
with content as csvfile:
@@ -102,7 +102,7 @@ def generate_notifications_csv(json_list):
x['template']['name'],
x['template']['template_type'],
x['job']['original_file_name'] if x['job'] else '',
x['status'],
format_notification_status(x['status'], x['template']['template_type']),
format_datetime(x['created_at'])])
retval = content.getvalue()
return retval