mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-06-24 09:21:06 -04:00
Put template_id back in the session
The start job endpoint needs the template ID in order to make the API call. It doesn’t make sense to add it to the start job URL, because users could potentially start a job with the wrong template by hacking the URL (which would blow up at some point, if the template didn’t match the columns in the file).
This commit is contained in:
@@ -547,6 +547,7 @@ def _check_messages(service_id, template_id, upload_id, preview_row, letters_as_
|
||||
|
||||
if any(recipients) and not recipients.has_errors:
|
||||
session['file_uploads'][upload_id]['notification_count'] = len(recipients)
|
||||
session['file_uploads'][upload_id]['template_id'] = str(template_id)
|
||||
session['file_uploads'][upload_id]['valid'] = True
|
||||
else:
|
||||
session['file_uploads'].pop(upload_id)
|
||||
|
||||
@@ -1443,9 +1443,9 @@ def test_upload_csvfile_with_valid_phone_shows_all_numbers(
|
||||
follow_redirects=True
|
||||
)
|
||||
with logged_in_client.session_transaction() as sess:
|
||||
assert 'template_id' not in sess['file_uploads'][fake_uuid]
|
||||
assert 'original_file_name' not in sess['file_uploads'][fake_uuid]
|
||||
assert sess['file_uploads'][fake_uuid]['notification_count'] == 53
|
||||
assert sess['file_uploads'][fake_uuid]['template_id'] == fake_uuid
|
||||
assert sess['file_uploads'][fake_uuid]['valid'] is True
|
||||
|
||||
content = response.get_data(as_text=True)
|
||||
|
||||
Reference in New Issue
Block a user