mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-09 17:45:32 -04:00
try mock
This commit is contained in:
@@ -942,6 +942,18 @@ def preview_notification(service_id, template_id):
|
|||||||
)
|
)
|
||||||
@user_has_permissions("send_messages", restrict_admin_usage=True)
|
@user_has_permissions("send_messages", restrict_admin_usage=True)
|
||||||
def send_notification(service_id, template_id):
|
def send_notification(service_id, template_id):
|
||||||
|
print("GOING TO GET RECIPIENT") # noqa
|
||||||
|
recipient = get_recipient()
|
||||||
|
print(f"RECIPIENT IS {recipient}, redirecting if None") # noqa
|
||||||
|
|
||||||
|
if not recipient:
|
||||||
|
return redirect(
|
||||||
|
url_for(
|
||||||
|
".send_one_off",
|
||||||
|
service_id=service_id,
|
||||||
|
template_id=template_id,
|
||||||
|
)
|
||||||
|
)
|
||||||
upload_id = _send_notification(service_id, template_id)
|
upload_id = _send_notification(service_id, template_id)
|
||||||
|
|
||||||
session.pop("recipient", "")
|
session.pop("recipient", "")
|
||||||
@@ -995,18 +1007,7 @@ def send_notification(service_id, template_id):
|
|||||||
|
|
||||||
def _send_notification(service_id, template_id):
|
def _send_notification(service_id, template_id):
|
||||||
scheduled_for = session.pop("scheduled_for", "")
|
scheduled_for = session.pop("scheduled_for", "")
|
||||||
print("GOING TO GET RECIPIENT") # noqa
|
|
||||||
recipient = get_recipient()
|
|
||||||
print(f"RECIPIENT IS {recipient}, redirecting if None") # noqa
|
|
||||||
|
|
||||||
if not recipient:
|
|
||||||
return redirect(
|
|
||||||
url_for(
|
|
||||||
".send_one_off",
|
|
||||||
service_id=service_id,
|
|
||||||
template_id=template_id,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
keys = []
|
keys = []
|
||||||
values = []
|
values = []
|
||||||
|
|||||||
@@ -2820,7 +2820,6 @@ def test_send_notification_redirects_if_missing_data(
|
|||||||
with client_request.session_transaction() as session:
|
with client_request.session_transaction() as session:
|
||||||
session.update(session_data)
|
session.update(session_data)
|
||||||
|
|
||||||
mocker.patch("app.main.views.send.s3upload", return_value=sample_uuid())
|
|
||||||
client_request.post(
|
client_request.post(
|
||||||
"main.send_notification",
|
"main.send_notification",
|
||||||
service_id=SERVICE_ONE_ID,
|
service_id=SERVICE_ONE_ID,
|
||||||
|
|||||||
Reference in New Issue
Block a user