summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-02-08 02:47:30 +0000
committerGerrit Code Review <review@openstack.org>2013-02-08 02:47:30 +0000
commit0e4514a5596e71afbdf60a5329e8c2d141a344fc (patch)
tree80ca569d24364d4672cd0b6ed56722c158ed2a25 /tests
parent131075abb9691c204ef74bd108123d5e5fa9b9b7 (diff)
parenta87819392ca42159773eda61defa01abbda0a2b9 (diff)
downloadoslo-0e4514a5596e71afbdf60a5329e8c2d141a344fc.tar.gz
oslo-0e4514a5596e71afbdf60a5329e8c2d141a344fc.tar.xz
oslo-0e4514a5596e71afbdf60a5329e8c2d141a344fc.zip
Merge "Allow to_primitive to ignore datetimes"
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/test_jsonutils.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/unit/test_jsonutils.py b/tests/unit/test_jsonutils.py
index f618a05..87ac367 100644
--- a/tests/unit/test_jsonutils.py
+++ b/tests/unit/test_jsonutils.py
@@ -58,6 +58,10 @@ class ToPrimitiveTestCase(utils.BaseTestCase):
self.assertEquals(jsonutils.to_primitive(x),
'1920-02-03T04:05:06.000007')
+ def test_datetime_preserve(self):
+ x = datetime.datetime(1920, 2, 3, 4, 5, 6, 7)
+ self.assertEquals(jsonutils.to_primitive(x, convert_datetime=False), x)
+
def test_DateTime(self):
x = xmlrpclib.DateTime()
x.decode("19710203T04:05:06")