mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-24 16:23:44 -04:00
Refactoring the send to provider code out of the tasks folder
- building a rest endpoint to call that code to compliment the existing task based approach.
This commit is contained in:
@@ -5,6 +5,7 @@ import pytest
|
||||
from mock import ANY
|
||||
|
||||
import app
|
||||
from sqlalchemy.orm.exc import NoResultFound
|
||||
from app import mmg_client
|
||||
from app.dao import (provider_details_dao, notifications_dao, provider_statistics_dao)
|
||||
from app.dao.provider_statistics_dao import get_provider_statistics
|
||||
@@ -46,6 +47,18 @@ def test_should_return_highest_priority_active_provider(notify_db, notify_db_ses
|
||||
assert send_to_providers.provider_to_use('sms', '1234').name == first.identifier
|
||||
|
||||
|
||||
def test_raises_not_found_exception_if_no_notification_for_id(notify_db, notify_db_session, mocker):
|
||||
mocker.patch('app.mmg_client.send_sms')
|
||||
mocker.patch('app.mmg_client.get_name', return_value="mmg")
|
||||
notification_id = uuid.uuid4()
|
||||
|
||||
with pytest.raises(NoResultFound) as exc:
|
||||
send_to_providers.send_sms_to_provider(notification_id)
|
||||
|
||||
assert str(exc.value) == "No notification for {}".format(str(notification_id))
|
||||
app.mmg_client.send_sms.assert_not_called()
|
||||
|
||||
|
||||
def test_should_send_personalised_template_to_correct_sms_provider_and_persist(
|
||||
notify_db,
|
||||
notify_db_session,
|
||||
|
||||
Reference in New Issue
Block a user