Dynamically adjust dates for the tests.
authorphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Sun, 23 Jul 2017 19:23:57 +0000 (19:23 +0000)
committerphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Sun, 23 Jul 2017 19:23:57 +0000 (19:23 +0000)
git-svn-id: http://www.winterrodeln.org/svn/wrfeed/trunk@2652 7aebc617-e5e2-0310-91dc-80fb5f6d2477

tests/test_wrfeed.py

index 5eaf220b91545f3087915b7633d28945a4b3e34e..29ed517563112e4e462f345d411f5095c47583c5 100644 (file)
@@ -37,6 +37,17 @@ class TestDbWrfeed(WrfeedTestBase):
                 sql = f.read()
             self.engine.execute(sql)
 
+            # update dates
+            con = self.engine.connect()
+            seconds_diff, = con.execute("SELECT TIMESTAMPDIFF(SECOND, '2017-03-31 07:00', now())").fetchone()
+            seconds_diff = int(seconds_diff)
+            con.execute("UPDATE wrreport SET date_report = DATE(date_report + INTERVAL %s SECOND)", (seconds_diff,))
+            con.execute("UPDATE wrreport SET time_report = TIME(time_report + INTERVAL %s SECOND)", (seconds_diff,))
+            con.execute("UPDATE wrreport SET date_entry = date_entry + INTERVAL %s SECOND", (seconds_diff,))
+            con.execute("UPDATE wrreport SET date_invalid = date_invalid + INTERVAL %s SECOND", (seconds_diff,))
+            con.execute("UPDATE wrreport SET delete_date = delete_date + INTERVAL %s SECOND", (seconds_diff,))
+
+
     def tearDown(self):
         with wrfeed.app.app_context():
             self.engine.execute("DROP DATABASE {}".format(self.uri.database))