Support Unicode request_id on Python 3
The oslo.context change If48ee7f4d1c113f1f26b3b1698c6b055807b950f will change request_id type on Python 3 from bytes to str. This change prepares Neutron for this change. Change-Id: I872c268ef5f17dc2c1fe0ce8aa7e8af4ebc1d757
This commit is contained in:
parent
90da40f425
commit
5c06fa6ea7
@ -32,6 +32,8 @@ class RequestIdTest(test_base.BaseTestCase):
|
||||
req = webob.Request.blank('/test')
|
||||
res = req.get_response(app)
|
||||
res_req_id = res.headers.get(request_id.HTTP_RESP_HEADER_REQUEST_ID)
|
||||
self.assertThat(res_req_id, matchers.StartsWith(b'req-'))
|
||||
if isinstance(res_req_id, bytes):
|
||||
res_req_id = res_req_id.decode('utf-8')
|
||||
self.assertThat(res_req_id, matchers.StartsWith('req-'))
|
||||
# request-id in request environ is returned as response body
|
||||
self.assertEqual(res_req_id, res.body)
|
||||
self.assertEqual(res_req_id, res.body.decode('utf-8'))
|
||||
|
Loading…
x
Reference in New Issue
Block a user