Ejemplo n.º 1
0
    def test_raise_error_without_mail(self):
        def func():
            raise Exception('Foo')

        with self.assertRaises(Exception):
            utils.email_uncaught_exception(func)()
        self.assertEqual(len(mail.outbox), 0)
Ejemplo n.º 2
0
    def test_raise_with_mail(self):
        def func():
            raise Exception("Foo")

        with self.assertRaises(Exception):
            utils.email_uncaught_exception(func)()
        self.assertEqual(len(mail.outbox), 1)
Ejemplo n.º 3
0
 def test_raise_with_mail(self):
     def func():
         raise Exception('Foo')
     with self.assertRaises(Exception):
         utils.email_uncaught_exception(func)()
     self.assertEqual(len(mail.outbox), 1)
     error_mail = mail.outbox[0]
     self.assertEqual(['foo@bar'], error_mail.to)
     self.assertIn("Exception('Foo')", error_mail.subject)
     if django.VERSION >= (1, 7):
         self.assertIn("Exception('Foo')", error_mail.body)
 def test_raise_with_mail(self):
     def func():
         raise Exception('Foo')
     with self.assertRaises(Exception):
         utils.email_uncaught_exception(func)()
     self.assertEqual(len(mail.outbox), 1)
     error_mail = mail.outbox[0]
     self.assertEqual(['foo@bar'], error_mail.to)
     self.assertIn("Exception('Foo')", error_mail.subject)
     if django.VERSION >= (1, 7):
         self.assertIn("Exception('Foo')", error_mail.body)
Ejemplo n.º 5
0
 def test_success(self):
     def func():
         pass
     utils.email_uncaught_exception(func)
Ejemplo n.º 6
0
    def test_success(self):
        def func():
            pass

        utils.email_uncaught_exception(func)
        self.assertEqual(len(mail.outbox), 0)
Ejemplo n.º 7
0
 def test_success(self):
     def func():
         pass
     utils.email_uncaught_exception(func)
Ejemplo n.º 8
0
 def test_raise_error_without_mail(self):
     def func():
         raise Exception('Foo')
     with self.assertRaises(Exception):
         utils.email_uncaught_exception(func)()
     self.assertEqual(len(mail.outbox), 0)
Ejemplo n.º 9
0
 def test_success(self):
     def func():
         pass
     utils.email_uncaught_exception(func)
     self.assertEqual(len(mail.outbox), 0)