Пример #1
0
 def test_app_exception_v3(self, mock_get_root_secret_from_kms,
                           mock_readconf):
     mock_get_root_secret_from_kms.return_value = (base64.b64encode(b'x' *
                                                                    32))
     mock_readconf.return_value = TEST_KMS_KEYMASTER_CONF
     app = kms_keymaster.KmsKeyMaster(FakeAppThatExcepts(),
                                      TEST_KMS_KEYMASTER_CONF)
     req = Request.blank('/', environ={'REQUEST_METHOD': 'PUT'})
     start_response, _ = capture_start_response()
     self.assertRaises(Exception, app, req.environ, start_response)
Пример #2
0
 def test_app_exception(self):
     app = proxy_logging.ProxyLoggingMiddleware(FakeAppThatExcepts(), {})
     app.access_logger = FakeLogger()
     req = Request.blank('/', environ={'REQUEST_METHOD': 'GET'})
     try:
         app(req.environ, start_response)
     except Exception:
         pass
     log_parts = self._log_parts(app)
     self.assertEqual(log_parts[6], '500')
     self.assertEqual(log_parts[10], '-')  # read length
Пример #3
0
 def test_app_exception(self):
     app = decrypter.Decrypter(FakeAppThatExcepts(HTTPException), {})
     req = Request.blank('/', environ={'REQUEST_METHOD': 'GET'})
     with self.assertRaises(HTTPException) as catcher:
         req.get_response(app)
     self.assertEqual(FakeAppThatExcepts.MESSAGE, catcher.exception.body)
Пример #4
0
 def test_app_exception(self):
     app = keymaster.KeyMaster(FakeAppThatExcepts(), TEST_KEYMASTER_CONF)
     req = Request.blank('/', environ={'REQUEST_METHOD': 'PUT'})
     start_response, _ = capture_start_response()
     self.assertRaises(Exception, app, req.environ, start_response)