Merge pull request #2086 from alphagov/user-name-for-csv-download

Add created_by_name to the Notification.serialize_for_csv.
This commit is contained in:
Rebecca Law
2018-09-07 11:37:32 +01:00
committed by GitHub
2 changed files with 4 additions and 2 deletions

View File

@@ -1324,7 +1324,8 @@ class Notification(db.Model):
"template_type": self.template.template_type,
"job_name": self.job.original_file_name if self.job else '',
"status": self.formatted_status,
"created_at": time.strftime('%A %d %B %Y at %H:%M', created_at_in_bst.timetuple())
"created_at": time.strftime('%A %d %B %Y at %H:%M', created_at_in_bst.timetuple()),
"created_by_name": self.get_created_by_name(),
}
return serialized

View File

@@ -815,4 +815,5 @@ def test_get_all_notifications_for_job_returns_csv_format(
assert len(resp['notifications']) == 1
notification = resp['notifications'][0]
assert set(notification.keys()) == \
set(['created_at', 'template_type', 'template_name', 'job_name', 'status', 'row_number', 'recipient'])
set(['created_at', 'created_by_name', 'template_type',
'template_name', 'job_name', 'status', 'row_number', 'recipient'])