[tz support] more tests
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 15 Apr 2011 08:18:59 +0200
changeset 7228 9d04e12d2d39
parent 7227 23d9c1f89c96
child 7229 a60522259c2c
[tz support] more tests
server/test/unittest_postgres.py
--- a/server/test/unittest_postgres.py	Fri Apr 15 08:18:06 2011 +0200
+++ b/server/test/unittest_postgres.py	Fri Apr 15 08:18:59 2011 +0200
@@ -15,12 +15,12 @@
 from unittest_querier import FixedOffset
 
 class PostgresFTITC(CubicWebTC):
-    config = ApptestConfiguration('data', sourcefile='sources_postgres')
-
     @classmethod
     def setUpClass(cls):
         if not AT_LOGILAB: # XXX here until we can raise SkipTest in setUp to detect we can't connect to the db
             raise SkipTest('XXX %s: require logilab configuration' % cls.__name__)
+        cls.config = ApptestConfiguration('data', sourcefile='sources_postgres',
+                                          apphome=cls.datadir)
 
     def test_occurence_count(self):
         req = self.request()
@@ -71,7 +71,12 @@
         datenaiss = self.execute("Any XD WHERE X nom 'bob', X tzdatenaiss XD")[0][0]
         self.assertEqual(datenaiss.tzinfo, None)
         self.assertEqual(datenaiss.utctimetuple()[:5], (1977, 6, 7, 1, 0))
-
+        self.commit()
+        self.execute("INSERT Personne X: X nom 'boby', X tzdatenaiss %(date)s",
+                     {'date': datetime(1977, 6, 7, 2, 0)})
+        datenaiss = self.execute("Any XD WHERE X nom 'boby', X tzdatenaiss XD")[0][0]
+        self.assertEqual(datenaiss.tzinfo, None)
+        self.assertEqual(datenaiss.utctimetuple()[:5], (1977, 6, 7, 2, 0))
 
 if __name__ == '__main__':
     from logilab.common.testlib import unittest_main