From e289c5835dfa4e047d147c8da8c8c313d6032aa4 Mon Sep 17 00:00:00 2001 From: Greg Price Date: Fri, 8 Feb 2019 13:59:38 -0800 Subject: [PATCH] push notif tests: Use mock.patch instead of `apn.gcm = None`. This is what it's for -- and it cleans up after itself, too. --- zerver/tests/test_push_notifications.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/zerver/tests/test_push_notifications.py b/zerver/tests/test_push_notifications.py index 3b41a581d1..f971f09f53 100644 --- a/zerver/tests/test_push_notifications.py +++ b/zerver/tests/test_push_notifications.py @@ -1367,8 +1367,9 @@ class GCMSendTest(PushNotificationTest): return data @mock.patch('zerver.lib.push_notifications.logger.debug') - def test_gcm_is_none(self, mock_debug: mock.MagicMock) -> None: - apn.gcm = None + @mock.patch('zerver.lib.push_notifications.gcm') + def test_gcm_is_none(self, mock_gcm: mock.MagicMock, mock_debug: mock.MagicMock) -> None: + mock_gcm.__bool__.return_value = False apn.send_android_push_notification_to_user(self.user_profile, {}, {}) mock_debug.assert_called_with( "Skipping sending a GCM push notification since PUSH_NOTIFICATION_BOUNCER_URL "