def test_should_sync_timezone(self):
        domain = Domain(name='test', default_timezone='Africa/Johannesburg')
        # yesterday at 21:59:59 = yesterday at 23:59:59 locally
        last_sync = datetime.combine(date.today() - timedelta(days=1), time(21, 59, 59))
        # yesterday at 21:59:59 = today at 00:00:00 locally
        utcnow = datetime.combine(date.today() - timedelta(days=1), time(22, 00, 00))
        self.assertTrue(should_sync(domain, SyncLog(date=last_sync), utcnow=utcnow))

        domain = Domain(name='test', default_timezone='UTC')
        self.assertFalse(should_sync(domain, SyncLog(date=last_sync), utcnow=utcnow))
    def test_should_sync_timezone(self):
        domain = Domain(name='test', default_timezone='Africa/Johannesburg')
        # yesterday at 21:59:59 = yesterday at 23:59:59 locally
        last_sync = datetime.combine(date.today() - timedelta(days=1), time(21, 59, 59))
        # yesterday at 21:59:59 = today at 00:00:00 locally
        utcnow = datetime.combine(date.today() - timedelta(days=1), time(22, 00, 00))
        self.assertTrue(should_sync(domain, SyncLog(date=last_sync), utcnow=utcnow))

        domain = Domain(name='test', default_timezone='UTC')
        self.assertFalse(should_sync(domain, SyncLog(date=last_sync), utcnow=utcnow))
예제 #3
0
 def test_should_sync_true(self):
     domain = Domain(name='test', default_timezone='UTC')
     last_sync = datetime.combine(date.today() - timedelta(days=1),
                                  time(23, 59, 59))  # yesterday at 23:59:59
     self.assertTrue(should_sync(domain, SyncLog(date=last_sync)))
예제 #4
0
 def test_should_sync_false(self):
     domain = Domain(name='test', default_timezone='UTC')
     last_sync = datetime.combine(date.today(), time())  # today at 00:00:00
     self.assertFalse(should_sync(domain, SyncLog(date=last_sync)))
예제 #5
0
 def test_should_sync_no_date(self):
     self.assertTrue(should_sync(None, SyncLog()))
예제 #6
0
 def test_should_sync_none(self):
     self.assertTrue(should_sync(None, None))
 def test_should_sync_true(self):
     domain = Domain(name='test', default_timezone='UTC')
     last_sync = datetime.combine(date.today() - timedelta(days=1), time(23, 59, 59))  # yesterday at 23:59:59
     self.assertTrue(should_sync(domain, SyncLog(date=last_sync)))
 def test_should_sync_false(self):
     domain = Domain(name='test', default_timezone='UTC')
     last_sync = datetime.combine(date.today(), time())  # today at 00:00:00
     self.assertFalse(should_sync(domain, SyncLog(date=last_sync)))
 def test_should_sync_no_date(self):
     self.assertTrue(should_sync(None, SyncLog()))
 def test_should_sync_none(self):
     self.assertTrue(should_sync(None, None))