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')
def test_format_int_status(self): req = MagicMock() resp = MagicMock() resp.status = 200 hook_format(req, resp) self.assertEquals(resp.status, '200 OK')
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'