mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-14 09:12:06 -05:00
Updates after code review.
- Remove print - Update exception message.
This commit is contained in:
@@ -33,7 +33,7 @@ def deliver_sms(self, notification_id):
|
|||||||
)
|
)
|
||||||
self.retry(queue=QueueNames.RETRY)
|
self.retry(queue=QueueNames.RETRY)
|
||||||
except self.MaxRetriesExceededError:
|
except self.MaxRetriesExceededError:
|
||||||
message = "RETRY FAILED: task send_sms_to_provider failed for notification {}. " \
|
message = "RETRY FAILED: Max retries reached. The task send_sms_to_provider failed for notification {}. " \
|
||||||
"Notification has been updated to technical-failure".format(notification_id)
|
"Notification has been updated to technical-failure".format(notification_id)
|
||||||
update_notification_status_by_id(notification_id, NOTIFICATION_TECHNICAL_FAILURE)
|
update_notification_status_by_id(notification_id, NOTIFICATION_TECHNICAL_FAILURE)
|
||||||
raise NotificationTechnicalFailureException(message)
|
raise NotificationTechnicalFailureException(message)
|
||||||
@@ -57,7 +57,8 @@ def deliver_email(self, notification_id):
|
|||||||
)
|
)
|
||||||
self.retry(queue=QueueNames.RETRY)
|
self.retry(queue=QueueNames.RETRY)
|
||||||
except self.MaxRetriesExceededError:
|
except self.MaxRetriesExceededError:
|
||||||
message = "RETRY FAILED: task send_email_to_provider failed for notification {}. " \
|
message = "RETRY FAILED: Max retries reached. " \
|
||||||
|
"The task send_email_to_provider failed for notification {}. " \
|
||||||
"Notification has been updated to technical-failure".format(notification_id)
|
"Notification has been updated to technical-failure".format(notification_id)
|
||||||
update_notification_status_by_id(notification_id, NOTIFICATION_TECHNICAL_FAILURE)
|
update_notification_status_by_id(notification_id, NOTIFICATION_TECHNICAL_FAILURE)
|
||||||
raise NotificationTechnicalFailureException(message)
|
raise NotificationTechnicalFailureException(message)
|
||||||
|
|||||||
@@ -184,7 +184,6 @@ def test_update_status_of_notifications_after_timeout(notify_api, sample_templat
|
|||||||
seconds=current_app.config.get('SENDING_NOTIFICATIONS_TIMEOUT_PERIOD') + 10))
|
seconds=current_app.config.get('SENDING_NOTIFICATIONS_TIMEOUT_PERIOD') + 10))
|
||||||
with pytest.raises(NotificationTechnicalFailureException) as e:
|
with pytest.raises(NotificationTechnicalFailureException) as e:
|
||||||
timeout_notifications()
|
timeout_notifications()
|
||||||
print(e.value.message)
|
|
||||||
assert str(not2.id) in e.value.message
|
assert str(not2.id) in e.value.message
|
||||||
assert not1.status == 'temporary-failure'
|
assert not1.status == 'temporary-failure'
|
||||||
assert not2.status == 'technical-failure'
|
assert not2.status == 'technical-failure'
|
||||||
|
|||||||
Reference in New Issue
Block a user