13 AT_LOGILAB = socket.gethostname().endswith('.logilab.fr') # XXX |
13 AT_LOGILAB = socket.gethostname().endswith('.logilab.fr') # XXX |
14 |
14 |
15 from unittest_querier import FixedOffset |
15 from unittest_querier import FixedOffset |
16 |
16 |
17 class PostgresFTITC(CubicWebTC): |
17 class PostgresFTITC(CubicWebTC): |
18 config = ApptestConfiguration('data', sourcefile='sources_postgres') |
|
19 |
|
20 @classmethod |
18 @classmethod |
21 def setUpClass(cls): |
19 def setUpClass(cls): |
22 if not AT_LOGILAB: # XXX here until we can raise SkipTest in setUp to detect we can't connect to the db |
20 if not AT_LOGILAB: # XXX here until we can raise SkipTest in setUp to detect we can't connect to the db |
23 raise SkipTest('XXX %s: require logilab configuration' % cls.__name__) |
21 raise SkipTest('XXX %s: require logilab configuration' % cls.__name__) |
|
22 cls.config = ApptestConfiguration('data', sourcefile='sources_postgres', |
|
23 apphome=cls.datadir) |
24 |
24 |
25 def test_occurence_count(self): |
25 def test_occurence_count(self): |
26 req = self.request() |
26 req = self.request() |
27 c1 = req.create_entity('Card', title=u'c1', |
27 c1 = req.create_entity('Card', title=u'c1', |
28 content=u'cubicweb cubicweb cubicweb') |
28 content=u'cubicweb cubicweb cubicweb') |
69 self.execute("INSERT Personne X: X nom 'bob', X tzdatenaiss %(date)s", |
69 self.execute("INSERT Personne X: X nom 'bob', X tzdatenaiss %(date)s", |
70 {'date': datetime(1977, 6, 7, 2, 0, tzinfo=FixedOffset(1))}) |
70 {'date': datetime(1977, 6, 7, 2, 0, tzinfo=FixedOffset(1))}) |
71 datenaiss = self.execute("Any XD WHERE X nom 'bob', X tzdatenaiss XD")[0][0] |
71 datenaiss = self.execute("Any XD WHERE X nom 'bob', X tzdatenaiss XD")[0][0] |
72 self.assertEqual(datenaiss.tzinfo, None) |
72 self.assertEqual(datenaiss.tzinfo, None) |
73 self.assertEqual(datenaiss.utctimetuple()[:5], (1977, 6, 7, 1, 0)) |
73 self.assertEqual(datenaiss.utctimetuple()[:5], (1977, 6, 7, 1, 0)) |
74 |
74 self.commit() |
|
75 self.execute("INSERT Personne X: X nom 'boby', X tzdatenaiss %(date)s", |
|
76 {'date': datetime(1977, 6, 7, 2, 0)}) |
|
77 datenaiss = self.execute("Any XD WHERE X nom 'boby', X tzdatenaiss XD")[0][0] |
|
78 self.assertEqual(datenaiss.tzinfo, None) |
|
79 self.assertEqual(datenaiss.utctimetuple()[:5], (1977, 6, 7, 2, 0)) |
75 |
80 |
76 if __name__ == '__main__': |
81 if __name__ == '__main__': |
77 from logilab.common.testlib import unittest_main |
82 from logilab.common.testlib import unittest_main |
78 unittest_main() |
83 unittest_main() |