mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 10:21:14 -05:00
Revert "Fix research mode preview of precompiled letters"
This commit is contained in:
@@ -265,6 +265,12 @@ def process_letter_notification(*, letter_data, api_key, template, reply_to_text
|
|||||||
[str(notification.id)],
|
[str(notification.id)],
|
||||||
queue=QueueNames.CREATE_LETTERS_PDF
|
queue=QueueNames.CREATE_LETTERS_PDF
|
||||||
)
|
)
|
||||||
|
elif (api_key.service.research_mode and
|
||||||
|
current_app.config['NOTIFY_ENVIRONMENT'] in ['preview', 'development']):
|
||||||
|
create_fake_letter_response_file.apply_async(
|
||||||
|
(notification.reference,),
|
||||||
|
queue=QueueNames.RESEARCH_MODE
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
if precompiled and api_key.key_type == KEY_TYPE_TEST:
|
if precompiled and api_key.key_type == KEY_TYPE_TEST:
|
||||||
filename = upload_letter_pdf(notification, letter_content)
|
filename = upload_letter_pdf(notification, letter_content)
|
||||||
@@ -275,14 +281,6 @@ def process_letter_notification(*, letter_data, api_key, template, reply_to_text
|
|||||||
kwargs={'filename': filename},
|
kwargs={'filename': filename},
|
||||||
queue=QueueNames.ANTIVIRUS,
|
queue=QueueNames.ANTIVIRUS,
|
||||||
)
|
)
|
||||||
elif (
|
|
||||||
api_key.service.research_mode and
|
|
||||||
current_app.config['NOTIFY_ENVIRONMENT'] in ['preview', 'development']
|
|
||||||
):
|
|
||||||
create_fake_letter_response_file.apply_async(
|
|
||||||
(notification.reference,),
|
|
||||||
queue=QueueNames.RESEARCH_MODE
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
update_notification_status_by_reference(notification.reference, NOTIFICATION_DELIVERED)
|
update_notification_status_by_reference(notification.reference, NOTIFICATION_DELIVERED)
|
||||||
|
|
||||||
|
|||||||
@@ -393,15 +393,12 @@ def test_post_letter_notification_is_delivered_if_in_trial_mode_and_using_test_k
|
|||||||
assert not fake_create_letter_task.called
|
assert not fake_create_letter_task.called
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('is_research_mode', [True, False])
|
|
||||||
def test_post_letter_notification_is_delivered_and_has_pdf_uploaded_to_test_letters_bucket_using_test_key(
|
def test_post_letter_notification_is_delivered_and_has_pdf_uploaded_to_test_letters_bucket_using_test_key(
|
||||||
client,
|
client,
|
||||||
notify_user,
|
notify_user,
|
||||||
mocker,
|
mocker
|
||||||
is_research_mode
|
|
||||||
):
|
):
|
||||||
sample_letter_service = create_service(
|
sample_letter_service = create_service(service_permissions=['letter', 'precompiled_letter'])
|
||||||
service_permissions=['letter', 'precompiled_letter'], research_mode=is_research_mode)
|
|
||||||
s3mock = mocker.patch('app.v2.notifications.post_notifications.upload_letter_pdf', return_value='test.pdf')
|
s3mock = mocker.patch('app.v2.notifications.post_notifications.upload_letter_pdf', return_value='test.pdf')
|
||||||
mocker.patch('app.v2.notifications.post_notifications.pdf_page_count', return_value=1)
|
mocker.patch('app.v2.notifications.post_notifications.pdf_page_count', return_value=1)
|
||||||
mock_celery = mocker.patch("app.letters.rest.notify_celery.send_task")
|
mock_celery = mocker.patch("app.letters.rest.notify_celery.send_task")
|
||||||
|
|||||||
Reference in New Issue
Block a user