summaryrefslogtreecommitdiff
path: root/oslo_middleware
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2015-11-27 16:42:43 +0100
committerVictor Stinner <vstinner@redhat.com>2015-11-27 16:43:47 +0100
commit5c06fa6ea71cf9cd6526c1469dc6e12ab80a3fa1 (patch)
treed6901e301a2fdb2d3efdc471ed4807ec4eab3fe0 /oslo_middleware
parent90da40f425a15730d1207495e8dc77bbac5edee7 (diff)
downloadoslo-middleware-3.1.0.tar.gz
Support Unicode request_id on Python 33.1.0
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
Diffstat (limited to 'oslo_middleware')
-rw-r--r--oslo_middleware/tests/test_request_id.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/oslo_middleware/tests/test_request_id.py b/oslo_middleware/tests/test_request_id.py
index 09bdd32..76f3696 100644
--- a/oslo_middleware/tests/test_request_id.py
+++ b/oslo_middleware/tests/test_request_id.py
@@ -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'))