Пример #1
0
    def test_failed_user(self, mock_email):
        # We have one valid sender and one invalid one
        # The invalid one should be skipped while still letting
        # the valid one pass
        one = models.Service.objects.get(pk=1)
        NotificationEmail.create(obj=one, value="*****@*****.**")
        NotificationUser.create(obj=one, value="does not exist")

        response = self.fireAlert()
        self.assertRoute(response, rest.AlertReceiver, 202)
        self.assertCount(models.Alert, 1, "Alert Queued")

        self.assertEqual(mock_email.call_count, 1, "Still called email")
Пример #2
0
    def test_user_splay(self, mock_email, mock_post):
        one = models.Service.objects.get(pk=1)

        NotificationUser.create(obj=one, value=one.owner.username)
        NotificationLineNotify.create(obj=one.owner, value="#foo")
        NotificationEmail.create(obj=one.owner, value="*****@*****.**")

        response = self.fireAlert()
        self.assertRoute(response, rest.AlertReceiver, 202)
        self.assertCount(models.Alert, 1, "Alert Queued")

        # Since we test the specifics elsewhere, just want to check
        # the count of calls here
        self.assertEqual(mock_post.call_count, 1, "Called LINE Notify")
        self.assertEqual(mock_email.call_count, 1, "Called email")
Пример #3
0
    def setUp(self, mock_signal):
        one = models.Project.objects.get(pk=1)
        two = models.Project.objects.get(pk=2)

        NotificationEmail.create(obj=one, value="*****@*****.**")
        NotificationEmail.create(obj=one, value="*****@*****.**")
        NotificationEmail.create(obj=two, value="*****@*****.**")