Пример #1
0
    def test_runJobHandleErrors_oops_generated_user_notify_fails(self):
        """A second oops is logged if the notification of the oops fails.

        In this test case the error is a user expected error, so the
        notifyUserError is called, and in this case the notify raises too.
        """
        job = RaisingJobRaisingNotifyUserError('boom')
        runner = JobRunner([job])
        runner.runJobHandleError(job)
        self.assertEqual(1, len(self.oopses))
Пример #2
0
 def test_runJobHandleErrors_oops_timeline_detail_filter(self):
     """A job can choose to filter oops timeline details."""
     job = RaisingJobTimelineMessage('boom')
     job.timeline_detail_filter = lambda _, detail: '<redacted>'
     flush_database_updates()
     runner = JobRunner([job])
     runner.runJobHandleError(job)
     self.assertEqual(1, len(self.oopses))
     actions = [action[2:4] for action in self.oopses[0]['timeline']]
     self.assertIn(('job', '<redacted>'), actions)
Пример #3
0
    def test_runJobHandleErrors_oops_generated_user_notify_fails(self):
        """A second oops is logged if the notification of the oops fails.

        In this test case the error is a user expected error, so the
        notifyUserError is called, and in this case the notify raises too.
        """
        job = RaisingJobRaisingNotifyUserError('boom')
        runner = JobRunner([job])
        runner.runJobHandleError(job)
        self.assertEqual(1, len(self.oopses))
Пример #4
0
 def test_runJobHandleErrors_oops_timeline(self):
     """The oops timeline only covers the job itself."""
     timeline = get_request_timeline(get_current_browser_request())
     timeline.start('test', 'sentinel').finish()
     job = RaisingJobTimelineMessage('boom')
     flush_database_updates()
     runner = JobRunner([job])
     runner.runJobHandleError(job)
     self.assertEqual(1, len(self.oopses))
     actions = [action[2:4] for action in self.oopses[0]['timeline']]
     self.assertIn(('job', 'boom'), actions)
     self.assertNotIn(('test', 'sentinel'), actions)
Пример #5
0
 def test_runJobHandleErrors_oops_generated_notify_fails(self):
     """A second oops is logged if the notification of the oops fails."""
     job = RaisingJobRaisingNotifyOops('boom')
     runner = JobRunner([job])
     runner.runJobHandleError(job)
     self.assertEqual(2, len(self.oopses))
Пример #6
0
 def test_runJobHandleErrors_user_error_no_oops(self):
     """If the job raises a user error, there is no oops."""
     job = RaisingJobUserError('boom')
     runner = JobRunner([job])
     runner.runJobHandleError(job)
     self.assertEqual(0, len(self.oopses))
Пример #7
0
 def test_runJobHandleErrors_oops_generated(self):
     """The handle errors method records an oops for raised errors."""
     job = RaisingJob('boom')
     runner = JobRunner([job])
     runner.runJobHandleError(job)
     self.assertEqual(1, len(self.oopses))
Пример #8
0
 def test_runJobHandleErrors_oops_generated_notify_fails(self):
     """A second oops is logged if the notification of the oops fails."""
     job = RaisingJobRaisingNotifyOops('boom')
     runner = JobRunner([job])
     runner.runJobHandleError(job)
     self.assertEqual(2, len(self.oopses))
Пример #9
0
 def test_runJobHandleErrors_user_error_no_oops(self):
     """If the job raises a user error, there is no oops."""
     job = RaisingJobUserError('boom')
     runner = JobRunner([job])
     runner.runJobHandleError(job)
     self.assertEqual(0, len(self.oopses))
Пример #10
0
 def test_runJobHandleErrors_oops_generated(self):
     """The handle errors method records an oops for raised errors."""
     job = RaisingJob('boom')
     runner = JobRunner([job])
     runner.runJobHandleError(job)
     self.assertEqual(1, len(self.oopses))