mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-02 09:26:08 -05:00
Fix for simulated notifications.
When a post is made for a simulated number the id is empty in the notificaiton object that we return. This fixes that.
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import uuid
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from flask import current_app
|
from flask import current_app
|
||||||
@@ -53,7 +54,8 @@ def persist_notification(
|
|||||||
created_by_id=None
|
created_by_id=None
|
||||||
):
|
):
|
||||||
notification_created_at = created_at or datetime.utcnow()
|
notification_created_at = created_at or datetime.utcnow()
|
||||||
|
if not notification_id and simulated:
|
||||||
|
notification_id = uuid.uuid4()
|
||||||
notification = Notification(
|
notification = Notification(
|
||||||
id=notification_id,
|
id=notification_id,
|
||||||
template_id=template_id,
|
template_id=template_id,
|
||||||
|
|||||||
@@ -201,6 +201,7 @@ def test_should_not_persist_or_send_notification_if_simulated_recipient(
|
|||||||
|
|
||||||
assert response.status_code == 201
|
assert response.status_code == 201
|
||||||
apply_async.assert_not_called()
|
apply_async.assert_not_called()
|
||||||
|
assert json.loads(response.get_data(as_text=True))["id"]
|
||||||
assert Notification.query.count() == 0
|
assert Notification.query.count() == 0
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user