Exemplo n.º 1
0
    def test_send_js_errors(self):
        response = send_js_errors()
        self.assertFalse(response)
        self.assertEqual(len(mail.outbox), 0)

        UncaughtError.objects.create(
            message="oh no!",
            current_url="perma.cc/about",
            created_at=datetime.now(),
            stack="Bad error stacktrace",
        ).save()

        response = send_js_errors()
        self.assertTrue(response)

        message = mail.outbox[0]
        self.assertIn("oh no!", message.body)
        self.assertIn("Bad error stacktrace", message.body)
Exemplo n.º 2
0
    def test_send_js_errors(self):
        response = send_js_errors()
        self.assertFalse(response)
        self.assertEqual(len(mail.outbox), 0)

        UncaughtError.objects.create(
            message="oh no!",
            current_url="perma.cc/about",
            created_at=datetime.now(),
            stack="Bad error stacktrace",
        ).save()

        response = send_js_errors()
        self.assertTrue(response)

        message = mail.outbox[0]
        self.assertIn("oh no!", message.body)
        self.assertIn("Bad error stacktrace", message.body)
Exemplo n.º 3
0
    def test_send_js_errors(self):
        response = send_js_errors()
        self.assertFalse(response)
        self.assertEqual(len(mail.outbox), 0)
        unruly_stack_trace = u'[{"function": "getNextContents", "column": 6, "line": 304, "file": "static/bundles/create.js"}, {"function": "showFolderContents", "column": 4, "line": 335, "file": "static/bundles/create.js"}]'
        err = UncaughtError.objects.create(message="oh no!",
                                           current_url="perma.cc/about",
                                           stack=unruly_stack_trace)
        err.save()

        response = send_js_errors()
        self.assertTrue(response)

        message = mail.outbox[0]
        message_parts = message.body.split('\n')
        self.assertIn('URL: %s' % err.current_url, message_parts)
        self.assertIn('Message: %s' % err.message, message_parts)
        self.assertIn('Function: getNextContents', message_parts)
        self.assertIn('File: static/bundles/create.js', message_parts)
        self.assertNotIn('showFolderContents', message_parts)
Exemplo n.º 4
0
    def test_send_js_errors(self):
        response = send_js_errors()
        self.assertFalse(response)
        self.assertEqual(len(mail.outbox), 0)
        unruly_stack_trace = u'[{"function": "getNextContents", "column": 6, "line": 304, "file": "static/bundles/create.js"}, {"function": "showFolderContents", "column": 4, "line": 335, "file": "static/bundles/create.js"}]'
        err = UncaughtError.objects.create(
            message="oh no!",
            current_url="perma.cc/about",
            stack=unruly_stack_trace)
        err.save()

        response = send_js_errors()
        self.assertTrue(response)

        message = mail.outbox[0]
        message_parts = message.body.split('\n')
        self.assertIn('URL: %s' % err.current_url, message_parts)
        self.assertIn('Message: %s' % err.message, message_parts)
        self.assertIn('Function: getNextContents', message_parts)
        self.assertIn('File: static/bundles/create.js', message_parts)
        self.assertNotIn('showFolderContents', message_parts)