mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 14:29:51 -04:00
Fix bug with letter job CSV downloads
We were throwing an exception when instantiating a LetterImageTemplate
as we weren't giving it all the arguments it needed.
Now we give it all the correct parameters and add a
test for the method. Ideally we would add a unit test for the flask
route for downloading a letter job CSV (which is currently lacking) but
I did the minimal to be confident I've fixed the bug as I think this
whole code may be fresh for a bit of a rewrite according to Chris.
Original error:
```
File "/Users/davidmcdonald/.virtualenvs/notifications-admin/lib/python3.6/site-packages/notifications_utils/template.py", line 669, in __init__
raise TypeError('image_url is required')
TypeError: image_url is required
```
This commit is contained in:
@@ -157,7 +157,9 @@ def get_sample_template(template_type):
|
||||
if template_type == 'sms':
|
||||
return SMSPreviewTemplate({'content': 'any', 'template_type': 'sms'})
|
||||
if template_type == 'letter':
|
||||
return LetterImageTemplate({'content': 'any', 'subject': '', 'template_type': 'letter'})
|
||||
return LetterImageTemplate(
|
||||
{'content': 'any', 'subject': '', 'template_type': 'letter'}, postage='second', image_url='x', page_count=1
|
||||
)
|
||||
|
||||
|
||||
def generate_notifications_csv(**kwargs):
|
||||
|
||||
Reference in New Issue
Block a user