예제 #1
0
    def test_filter_tokens_from_log(self):
        logger = self.useFixture(fixtures.FakeLogger(nuke_handlers=False))

        @webob.dec.wsgify
        def application(req):
            raise Exception()

        app = catch_errors.CatchErrors(application)
        req = webob.Request.blank('/test',
                                  text=u'test data',
                                  method='POST',
                                  headers={
                                      'X-Auth-Token': 'secret1',
                                      'X-Service-Token': 'secret2',
                                      'X-Other-Token': 'secret3'
                                  })
        res = req.get_response(app)
        self.assertEqual(500, res.status_int)

        output = logger.output

        self.assertIn('X-Auth-Token: *****', output)
        self.assertIn('X-Service-Token: *****', output)
        self.assertIn('X-Other-Token: *****', output)
        self.assertIn('test data', output)
예제 #2
0
 def _test_has_request_id(self, application, expected_code=None):
     app = catch_errors.CatchErrors(application)
     req = webob.Request.blank('/test')
     req.environ['HTTP_X_AUTH_TOKEN'] = 'hello=world'
     res = req.get_response(app)
     self.assertEqual(expected_code, res.status_int)
 def _test_has_request_id(self, application, expected_code=None):
     app = catch_errors.CatchErrors(application)
     req = webob.Request.blank('/test')
     res = req.get_response(app)
     self.assertEqual(expected_code, res.status_int)