Exemplo n.º 1
0
 def test_debugging_logger_logs_request(self):
     logger = self.useFixture(FakeLogger('maasserver', logging.DEBUG))
     request = factory.make_fake_request("/MAAS/api/2.0/nodes/")
     request.content = "test content"
     self.process_request(request)
     debug_output = DebuggingLoggerMiddleware._build_request_repr(request)
     self.assertThat(logger.output, Contains(debug_output))
Exemplo n.º 2
0
 def test_debugging_logger_does_not_log_response_if_no_debug_http(self):
     logger = self.useFixture(FakeLogger('maasserver', logging.DEBUG))
     request = factory.make_fake_request("/MAAS/api/2.0/nodes/")
     response = HttpResponse(content="test content",
                             content_type=b"text/plain; charset=utf-8")
     self.process_request(request, response)
     debug_output = DebuggingLoggerMiddleware._build_request_repr(request)
     self.assertThat(logger.output, Not(Contains(debug_output)))
Exemplo n.º 3
0
 def test_debugging_logger_does_not_log_request_if_info_level(self):
     logger = self.useFixture(FakeLogger('maasserver', logging.INFO))
     request = factory.make_fake_request("/MAAS/api/2.0/nodes/")
     self.process_request(request)
     debug_output = DebuggingLoggerMiddleware._build_request_repr(request)
     self.assertThat(logger.output, Not(Contains(debug_output)))