From fdb481a85f8a93dc3aaedbae4177ae7e275c12f2 Mon Sep 17 00:00:00 2001
From: Nicolas Delaby <nicolas@nexedi.com>
Date: Mon, 22 Dec 2008 09:07:23 +0000
Subject: [PATCH] Test PropertyManager with date type values

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24955 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/tests/testBase.py | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/product/ERP5/tests/testBase.py b/product/ERP5/tests/testBase.py
index c15076a219..48ebd0d585 100644
--- a/product/ERP5/tests/testBase.py
+++ b/product/ERP5/tests/testBase.py
@@ -1059,6 +1059,22 @@ class TestERP5PropertyManager(unittest.TestCase):
     ob._setProperty('a_dummy_property', dummy_property_value, type='tales')
     self.assertEquals(ob.getProperty('a_dummy_property'), 1+2)
 
+  def test_setPropertyTypeDate(self):
+    """You can specify the type of the property in _setProperty"""
+    ob = self._makeOne('ob')
+    from DateTime import DateTime
+    dummy_property_value = DateTime()
+    ob._setProperty('a_dummy_property', dummy_property_value, type='date')
+    self.assertEquals(['date'], [x['type'] for x in ob.propertyMap()
+                                        if x['id'] == 'a_dummy_property'])
+    self.assertEquals(type(ob.getProperty('a_dummy_property')), type(DateTime()))
+    #Set Property without type argument
+    ob._setProperty('a_second_dummy_property', dummy_property_value)
+    self.assertEquals(['date'], [x['type'] for x in ob.propertyMap()
+                                        if x['id'] == 'a_second_dummy_property'])
+    self.assertEquals(type(ob.getProperty('a_second_dummy_property')),
+                      type(DateTime()))
+
   def test_getPropertyNonExistantProps(self):
     """getProperty return None if the value is not found.
     """
-- 
2.30.9