summaryrefslogtreecommitdiff
path: root/keystoneclient/tests/unit
diff options
context:
space:
mode:
authorTin Lam <tinlam@gmail.com>2017-01-16 23:14:42 -0600
committerSteve Martinelli <s.martinelli@gmail.com>2017-01-17 21:56:25 +0000
commit7c40ff8466dc5e49f93752ecb998db864f8e5598 (patch)
tree18760cd51e774a52c21f5ce3d07eb3881a4b5791 /keystoneclient/tests/unit
parentb69f3a1f0abcc13f65833d29036028bf3319a2cd (diff)
downloadpython-keystoneclient-3.5.1.tar.gz
Fix response body being omitted in debug mode incorrectlynewton-eol3.5.1stable/newton
In debug mode, when a response's header Content-Type is set to "application/json" with a parameter, i.e., "application/json; charset=UTF-8". This patch set ignores the additional parameter and only match the mimetype. Change-Id: Ie8fcb1061e0e49b039436947524cfdc704c83846 Closes-Bug: #1656981 (cherry picked from commit dcb719d0e51afa0253c144136b41f0e390c48c4c)
Diffstat (limited to 'keystoneclient/tests/unit')
-rw-r--r--keystoneclient/tests/unit/test_session.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/keystoneclient/tests/unit/test_session.py b/keystoneclient/tests/unit/test_session.py
index 5adc61f..7a3c57d 100644
--- a/keystoneclient/tests/unit/test_session.py
+++ b/keystoneclient/tests/unit/test_session.py
@@ -228,6 +228,16 @@ class SessionTests(utils.TestCase):
self.assertIn(body, self.logger.output)
self.assertNotIn(OMITTED_BODY % 'application/json', self.logger.output)
+ # Content-Type is set to application/json; charset=UTF-8
+ body = jsonutils.dumps({'token': {'id': '...'}})
+ self.stub_url(
+ 'POST', text=body,
+ headers={'Content-Type': 'application/json; charset=UTF-8'})
+ session.post(self.TEST_URL)
+ self.assertIn(body, self.logger.output)
+ self.assertNotIn(OMITTED_BODY % 'application/json; charset=UTF-8',
+ self.logger.output)
+
def test_unicode_data_in_debug_output(self):
"""Verify that ascii-encodable data is logged without modification."""
session = client_session.Session(verify=False)