Esempio n. 1
0
    def test_format_request_id(self):
        req = MagicMock()
        req.env = {'REQUEST_ID': '123456'}
        resp = MagicMock()

        hook_format(req, resp)

        resp.set_header.assert_called_with('X-Compute-Request-Id', '123456')
Esempio n. 2
0
    def test_format_int_status(self):
        req = MagicMock()
        resp = MagicMock()
        resp.status = 200

        hook_format(req, resp)

        self.assertEquals(resp.status, '200 OK')
Esempio n. 3
0
    def test_format(self):
        req = MagicMock()
        resp = MagicMock()
        resp.body = {"example": "JSON"}
        resp.content_type = None

        hook_format(req, resp)

        resp.body = '{"example": "JSON"}'
        resp.content_type = 'application/json'
Esempio n. 4
0
 def __call__(self, req, resp, **kwargs):
     hook_set_uuid(req, resp, kwargs)
     logger.warning("UNKNOWN PATH: %s %s", req.method, req.path)
     not_implemented(resp, 'Not Implemented', details='Not Implemented')
     hook_format(req, resp)
     hook_log_request(req, resp)
Esempio n. 5
0
File: nyi.py Progetto: Elu0/jumpgate
 def __call__(self, req, resp, **kwargs):
     hook_set_uuid(req, resp, kwargs)
     logger.warning("UNKNOWN PATH: %s %s", req.method, req.path)
     not_implemented(resp, 'Not Implemented', details='Not Implemented')
     hook_format(req, resp)
     hook_log_request(req, resp)