summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-01-08 19:20:12 +0000
committerGerrit Code Review <review@openstack.org>2013-01-08 19:20:12 +0000
commit5df2184cd0424e7034464ff387a86266b93e9bf5 (patch)
tree59c52bc1c377463cdca4e004b3e2853c876c743f /tests
parent1230c7a62760a13d00b58c7fc9c7fa50ab231c61 (diff)
parente3ddc41f1b02644d7fae4482c4beade7f27e58de (diff)
downloadoslo-5df2184cd0424e7034464ff387a86266b93e9bf5.tar.gz
oslo-5df2184cd0424e7034464ff387a86266b93e9bf5.tar.xz
oslo-5df2184cd0424e7034464ff387a86266b93e9bf5.zip
Merge "JSONDictSerializer encode objects to unicode"
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/test_wsgi.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/unit/test_wsgi.py b/tests/unit/test_wsgi.py
index 07c85d5..c621a8c 100644
--- a/tests/unit/test_wsgi.py
+++ b/tests/unit/test_wsgi.py
@@ -179,6 +179,17 @@ class JSONDictSerializerTest(unittest.TestCase):
result = result.replace('\n', '').replace(' ', '')
self.assertEqual(result, expected_json)
+ def test_object_unicode(self):
+ class TestUnicode:
+ def __unicode__(self):
+ return u'TestUnicode'
+ input_dict = dict(cls=TestUnicode())
+ expected_str = '{"cls":"TestUnicode"}'
+ serializer = wsgi.JSONDictSerializer()
+ result = serializer.serialize(input_dict)
+ result = result.replace('\n', '').replace(' ', '')
+ self.assertEqual(result, expected_str)
+
class TextDeserializerTest(unittest.TestCase):