diff options
| author | Tim Daly Jr <timjr@yahoo-inc.com> | 2012-06-26 02:48:42 +0000 |
|---|---|---|
| committer | Tim Daly Jr <timjr@yahoo-inc.com> | 2012-06-26 02:48:51 +0000 |
| commit | 4c9d439ef24f5afdd74aa9153aa8fc772051e6cb (patch) | |
| tree | 11d4991dc74b11ae4019a367a69274d0a56e3a41 /tests/unit | |
| parent | 5a93e1d790422ddf21c223ec77b0355e6b790021 (diff) | |
Add 'filedecoder' method to the jsonutils wrapper module.
Fixes bug #1017765
After version 3.3.2, the anyjson library will throw a KeyError if
filedecoder isn't present. The filedecoder is just like the decoder
except it takes a file instead of a string, like json.load() instead
of json.loads().
Change-Id: I7bd012a7b4afa9b1ec987c3e6393cc922b5dadff
Diffstat (limited to 'tests/unit')
| -rw-r--r-- | tests/unit/test_jsonutils.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/unit/test_jsonutils.py b/tests/unit/test_jsonutils.py index 5764f45..9b987cd 100644 --- a/tests/unit/test_jsonutils.py +++ b/tests/unit/test_jsonutils.py @@ -18,6 +18,7 @@ import datetime import unittest import xmlrpclib +import StringIO from openstack.common import jsonutils @@ -30,6 +31,10 @@ class JSONUtilsTestCase(unittest.TestCase): def test_loads(self): self.assertEqual(jsonutils.loads('{"a": "b"}'), {'a': 'b'}) + def test_load(self): + x = StringIO.StringIO('{"a": "b"}') + self.assertEqual(jsonutils.load(x), {'a': 'b'}) + class ToPrimitiveTestCase(unittest.TestCase): def test_list(self): |
