X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=tests%2Fdbtest_timestamps.py;h=8229e5dbdeb083ccce5ccc0121abf30a03c41d0e;hb=HEAD;hp=ff19d7d0ad18dd7d47be6d8887e25a5aa2c40d9e;hpb=695b2d37022b899f3305dc83d89aa6dfee8af55e;p=dak.git diff --git a/tests/dbtest_timestamps.py b/tests/dbtest_timestamps.py index ff19d7d0..8229e5db 100755 --- a/tests/dbtest_timestamps.py +++ b/tests/dbtest_timestamps.py @@ -15,17 +15,12 @@ class TimestampTestCase(DBDakTestCase): TODO: Should we check all tables? """ - def now(self): - local_session = DBConn().session() - query = local_session.query('now').from_statement('select now() as now') - local_session.close() - return query.one().now - def sleep(self): time.sleep(0.001) def test_timestamps(self): timestamp01 = self.now() + self.session.rollback() self.sleep() uid = Uid(uid = 'ftp-master@debian.org') self.session.add(uid) @@ -34,6 +29,7 @@ class TimestampTestCase(DBDakTestCase): modified01 = uid.modified self.sleep() timestamp02 = self.now() + self.session.rollback() self.assertTrue(timestamp01 < created01) self.assertTrue(timestamp01 < modified01) self.assertTrue(created01 < timestamp02) @@ -46,6 +42,7 @@ class TimestampTestCase(DBDakTestCase): self.assertEqual(created01, created02) self.assertTrue(modified01 < modified02) self.sleep() + self.session.rollback() timestamp03 = self.now() self.assertTrue(modified02 < timestamp03)