Add test for send_notification
@@ -21,6 +21,13 @@ class BuildNotificationsTests(TestCase):
self.version = fixture.get(Version, project=self.project)
self.build = fixture.get(Build, version=self.version)
+ @patch('readthedocs.builds.managers.log')
+ def test_send_notification_none_if_wrong_version_pk(self, mock_logger):
+ self.assertFalse(Version.objects.filter(pk=345343).exists())
+ send_notifications('345343', self.build.pk)
+ mock_logger.warning.assert_called_with('Version not found for the pk = 345343')
+
+
def test_send_notification_none(self):
send_notifications(self.version.pk, self.build.pk)
self.assertEqual(len(mail.outbox), 0)
