mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 00:07:02 -04:00
add tests for new check and send notification endpoints
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
|
||||
from contextlib import contextmanager
|
||||
import os
|
||||
from datetime import date, datetime, timedelta
|
||||
from unittest.mock import Mock
|
||||
@@ -61,11 +61,6 @@ def service_with_reply_to_addresses(api_user_active):
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
def mock_send_sms(request, mocker):
|
||||
return mocker.patch("app.service_api_client.send_sms")
|
||||
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
def fake_uuid():
|
||||
return sample_uuid()
|
||||
@@ -1665,6 +1660,19 @@ def mock_get_notification(mocker, fake_uuid, notification_status='delivered'):
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_send_notification(mocker, fake_uuid):
|
||||
def _send_notification(
|
||||
service_id, *, template_id, recipient, personalisation
|
||||
):
|
||||
return {'id': fake_uuid}
|
||||
|
||||
return mocker.patch(
|
||||
'app.notification_api_client.send_notification',
|
||||
side_effect=_send_notification
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
def client(app_):
|
||||
with app_.test_request_context(), app_.test_client() as client:
|
||||
@@ -1712,6 +1720,12 @@ def os_environ():
|
||||
def client_request(logged_in_client):
|
||||
class ClientRequest:
|
||||
|
||||
@staticmethod
|
||||
@contextmanager
|
||||
def session_transaction():
|
||||
with logged_in_client.session_transaction() as session:
|
||||
yield session
|
||||
|
||||
@staticmethod
|
||||
def get(endpoint, _expected_status=200, _follow_redirects=False, **endpoint_kwargs):
|
||||
resp = logged_in_client.get(
|
||||
|
||||
Reference in New Issue
Block a user