Commit a652aa0a authored by Sriram Karra's avatar Sriram Karra

Remove hard code initial timestamp for sync purposes

Move it to a single location inside utils.py
parent c2a05d80
......@@ -29,7 +29,6 @@ ASYNK_BASE_DIR = os.path.dirname(os.path.abspath(__file__))
EXTRA_PATHS = [os.path.join(ASYNK_BASE_DIR, 'lib'),
os.path.join(ASYNK_BASE_DIR, 'asynk'),]
sys.path = EXTRA_PATHS + sys.path
print sys.path
try:
from pimdb_ol import OLPIMDB
......@@ -788,8 +787,8 @@ class Asynk:
# will restore his earlier times dutifully.
if self.is_dry_run():
logging.debug('Temporarily resetting last sync times...')
conf.set_last_sync_start(pname, val="1980-01-01T00:00:00.00+00:00")
conf.set_last_sync_stop(pname, val="1980-01-01T00:00:00.00+00:00")
conf.set_last_sync_start(pname, val=utils.time_start)
conf.set_last_sync_stop(pname, val=utils.time_start)
sync = Sync(conf, pname, self.get_db(), dr=self.is_dry_run())
if self.is_dry_run():
......
......@@ -20,6 +20,8 @@
import iso8601, logging, os, re
time_start = "1980-01-01T00:00:00.00+00:00"
def yyyy_mm_dd_to_pytime (date_str):
## FIXME: Temporary hack to ensure we have a yyyy-mm-dd format. Google
## allows the year to be skipped. Outlook crates a problem. We bridge the
......
......@@ -26,6 +26,7 @@ EXTRA_PATHS = [os.path.join(DIR_PATH, 'lib'), os.path.join(DIR_PATH, 'asynk')]
sys.path = EXTRA_PATHS + sys.path
from state import Config, AsynkConfigError
import utils
user_dir = os.path.abspath('user_dir')
state_src = os.path.join('.', 'state.test.json')
......@@ -111,8 +112,8 @@ class TestStateFunctions(unittest.TestCase):
self.assertTrue(val['coll_2']['stid'] == None)
self.assertTrue(val['coll_2']['foid'] == None)
self.assertTrue(val['last_sync_start'] == "1980-01-01T00:00:00.00+00:00")
self.assertTrue(val['last_sync_stop'] == "1980-01-01T00:00:00.00+00:00")
self.assertTrue(val['last_sync_start'] == utils.time_start)
self.assertTrue(val['last_sync_stop'] == utils.time_start)
self.assertTrue(val['sync_dir'] == 'SYNC2WAY')
def test_read_ol_guid (self):
......@@ -170,7 +171,7 @@ class TestStateFunctions(unittest.TestCase):
def test_read_sync_start (self):
val = self.config.get_last_sync_start('defgcol')
self.assertTrue(val == "1980-01-01T00:00:00.00+00:00")
self.assertTrue(val == utils.time_start)
def test_write_sync_start (self):
t = self.config.get_curr_time()
......@@ -180,7 +181,7 @@ class TestStateFunctions(unittest.TestCase):
def test_read_sync_stop (self):
val = self.config.get_last_sync_stop('defgcol')
self.assertTrue(val =="1980-01-01T00:00:00.00+00:00")
self.assertTrue(val == utils.time_start)
def test_write_sync_stop (self):
t = self.config.get_curr_time()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment