mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 09:51:11 -05:00
add flag to return pdf content via api
this is only applicable when getting a single notification by id. it's also ignored if the notification isn't a letter. Otherwise, it overwrites the 'body' field in the response. If the notification's pdf is available, it returns that, base64 encoded. If the pdf is not available, it returns an empty string. The pdf won't be available if the notification's status is: * pending-virus-scan * virus-scan-failed * validation-failed * technical-failure The pdf will be retrieved from the correct s3 bucket based on its type
This commit is contained in:
@@ -80,6 +80,16 @@ def test_get_bucket_name_and_prefix_for_notification_precompiled_letter_using_te
|
||||
sample_precompiled_letter_notification_using_test_key.reference).upper()
|
||||
|
||||
|
||||
@freeze_time(FROZEN_DATE_TIME)
|
||||
def test_get_bucket_name_and_prefix_for_notification_templated_letter_using_test_key(sample_letter_notification):
|
||||
sample_letter_notification.key_type = KEY_TYPE_TEST
|
||||
|
||||
bucket, bucket_prefix = get_bucket_name_and_prefix_for_notification(sample_letter_notification)
|
||||
|
||||
assert bucket == current_app.config['TEST_LETTERS_BUCKET_NAME']
|
||||
assert bucket_prefix == 'NOTIFY.{}'.format(sample_letter_notification.reference).upper()
|
||||
|
||||
|
||||
@freeze_time(FROZEN_DATE_TIME)
|
||||
def test_get_bucket_name_and_prefix_for_failed_validation(sample_precompiled_letter_notification):
|
||||
sample_precompiled_letter_notification.status = NOTIFICATION_VALIDATION_FAILED
|
||||
|
||||
Reference in New Issue
Block a user