def test_process_response(self):
     RequestTrack.set_request_track_id("test_request_track_id")
     self.middleware.process_response(req=None,
                                      res=falcon.Response(),
                                      resource=None,
                                      req_succeeded=None)
     self.assertIsNone(RequestTrack.get_request_track_id())
 def test_process_request_with_headers(self):
     self.mock_wsgi_env["HTTP_REQUEST_TRACK_ID"] = "test_request_track_id"
     self.middleware.process_request(
         req=falcon.Request(env=self.mock_wsgi_env), res=None)
     self.assertEqual(RequestTrack.get_request_track_id(),
                      "test_request_track_id")
Beispiel #3
0
 def test_set_request_track_id_life_cycle(self):
     expected = "request_track_id"
     RequestTrack.set_request_track_id(expected)
     self.assertEqual(RequestTrack.get_request_track_id(), expected)
     RequestTrack.clear_request_track_id()
     self.assertIsNone(RequestTrack.get_request_track_id())
 def test_process_request_without_headers(self):
     self.middleware.process_request(
         req=falcon.Request(env=self.mock_wsgi_env), res=None)
     self.assertIsNotNone(RequestTrack.get_request_track_id())
 def process_response(self, req: Request, res: Response,
                      resource: BaseResource,
                      req_succeeded: bool) -> NoReturn:
     res.set_headers(
         headers={"request-track-id": RequestTrack.get_request_track_id()})
     RequestTrack.clear_request_track_id()