mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-16 10:12:32 -05:00
Combine two tests into one
This commit is contained in:
@@ -112,18 +112,6 @@ def test_should_retry_and_log_exception(sample_notification, mocker):
|
||||
assert sample_notification.status == 'created'
|
||||
|
||||
|
||||
def test_send_sms_should_switch_providers_on_provider_failure(sample_notification, mocker):
|
||||
provider_to_use = mocker.patch('app.delivery.send_to_providers.provider_to_use')
|
||||
provider_to_use.return_value.send_sms.side_effect = Exception('Error')
|
||||
switch_provider_mock = mocker.patch('app.delivery.send_to_providers.dao_toggle_sms_provider')
|
||||
mocker.patch('app.celery.provider_tasks.deliver_sms.retry')
|
||||
mocker.patch('app.delivery.send_to_providers.update_notification_provider')
|
||||
|
||||
deliver_sms(sample_notification.id)
|
||||
|
||||
assert switch_provider_mock.called is True
|
||||
|
||||
|
||||
def test_send_sms_should_not_switch_providers_on_non_provider_failure(
|
||||
sample_notification,
|
||||
mocker
|
||||
|
||||
@@ -569,7 +569,7 @@ def test_should_set_notification_billable_units_and_provider_if_sending_to_provi
|
||||
mocker,
|
||||
):
|
||||
mocker.patch('app.mmg_client.send_sms', side_effect=Exception())
|
||||
mocker.patch('app.delivery.send_to_providers.dao_toggle_sms_provider')
|
||||
mock_toggle_provider = mocker.patch('app.delivery.send_to_providers.dao_toggle_sms_provider')
|
||||
|
||||
sample_notification.billable_units = 0
|
||||
assert sample_notification.sent_by is None
|
||||
@@ -579,6 +579,7 @@ def test_should_set_notification_billable_units_and_provider_if_sending_to_provi
|
||||
|
||||
assert sample_notification.billable_units == 1
|
||||
assert sample_notification.sent_by == 'mmg'
|
||||
assert mock_toggle_provider.called
|
||||
|
||||
|
||||
def test_should_send_sms_to_international_providers(
|
||||
|
||||
Reference in New Issue
Block a user