From 98ef340bc60420913563f8c6b3cdddf9b45c6b1e Mon Sep 17 00:00:00 2001 From: Imdad Ahad Date: Wed, 14 Sep 2016 13:07:57 +0100 Subject: [PATCH] Refactor to use .count() method instead of mocking fake UUID --- tests/app/notifications/rest/test_send_notification.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/app/notifications/rest/test_send_notification.py b/tests/app/notifications/rest/test_send_notification.py index 153b443b4..0b5e5eaf0 100644 --- a/tests/app/notifications/rest/test_send_notification.py +++ b/tests/app/notifications/rest/test_send_notification.py @@ -952,9 +952,7 @@ def test_should_not_persist_notification_or_send_email_if_simulated_email( client, to_email, sample_email_template, - fake_uuid, mocker): - mocker.patch('app.notifications.rest.create_uuid', return_value=fake_uuid) apply_async = mocker.patch('app.celery.provider_tasks.send_email_to_provider.apply_async') data = { @@ -970,8 +968,8 @@ def test_should_not_persist_notification_or_send_email_if_simulated_email( headers=[('Content-Type', 'application/json'), auth_header]) assert response.status_code == 201 - assert not notifications_dao.get_notification_by_id(fake_uuid) apply_async.assert_not_called() + assert Notification.query.count() == 0 @pytest.mark.parametrize('to_sms', [ @@ -983,9 +981,7 @@ def test_should_not_persist_notification_or_send_sms_if_simulated_number( client, to_sms, sample_template, - fake_uuid, mocker): - mocker.patch('app.notifications.rest.create_uuid', return_value=fake_uuid) apply_async = mocker.patch('app.celery.provider_tasks.send_sms_to_provider.apply_async') data = { @@ -1001,5 +997,5 @@ def test_should_not_persist_notification_or_send_sms_if_simulated_number( headers=[('Content-Type', 'application/json'), auth_header]) assert response.status_code == 201 - assert not notifications_dao.get_notification_by_id(fake_uuid) apply_async.assert_not_called() + assert Notification.query.count() == 0