Exemplo n.º 1
0
    def test_get_response_catches_deadlock_failures(self):
        get_response = self.patch(WSGIHandler, "get_response")
        get_response.side_effect = make_deadlock_failure()

        handler = views.WebApplicationHandler(1)
        request = make_request()
        request.path = factory.make_name("path")
        response = handler.get_response(request)

        self.assertThat(get_response, MockCalledOnceWith(request))
        self.assertThat(response, IsInstance(HttpResponseConflict))
Exemplo n.º 2
0
    def test__get_response_sends_signal_on_deadlock_failures(self):
        get_response = self.patch(WSGIHandler, "get_response")
        get_response.side_effect = make_deadlock_failure()

        send_request_exception = self.patch_autospec(
            signals.got_request_exception, "send")

        handler = views.WebApplicationHandler(1)
        request = make_request()
        request.path = factory.make_name("path")
        handler.get_response(request)

        self.assertThat(
            send_request_exception,
            MockCalledOnceWith(sender=views.WebApplicationHandler,
                               request=request))
Exemplo n.º 3
0
 def test_ignores_deadlock_failures(self):
     request = self.make_fake_request()
     exception = make_deadlock_failure()
     self.assertRaises(type(exception), self.process_exception, request,
                       exception)
Exemplo n.º 4
0
 def test_ignores_deadlock_failures(self):
     base_path = self.make_base_path()
     middleware = self.make_middleware(base_path)
     request = factory.make_fake_request(base_path)
     exception = make_deadlock_failure()
     self.assertIsNone(middleware.process_exception(request, exception))