Beispiel #1
0
    def test_should_provide_last_successful_sync(self):
        self.assertIsNone(SyncInfo.last_successful_sync())

        start_time = timezone.now()
        successful_sync = SyncInfo.objects.create(status=SyncInfo.STATUS.SUCCESSFUL, start_time=start_time)
        self.assertEqual(SyncInfo.last_successful_sync(), successful_sync)

        SyncInfo.objects.create(status=SyncInfo.STATUS.FAILED, start_time=start_time)
        self.assertEqual(SyncInfo.last_successful_sync(), successful_sync)
Beispiel #2
0
    def test_should_provide_last_successful_sync(self):
        self.assertIsNone(SyncInfo.last_successful_sync())

        start_time = timezone.now()
        successful_sync = SyncInfo.objects.create(
            status=SyncInfo.STATUS.SUCCESSFUL, start_time=start_time)
        self.assertEqual(SyncInfo.last_successful_sync(), successful_sync)

        SyncInfo.objects.create(status=SyncInfo.STATUS.FAILED,
                                start_time=start_time)
        self.assertEqual(SyncInfo.last_successful_sync(), successful_sync)
Beispiel #3
0
def list_nodes_to_update():
    last_sync = SyncInfo.last_successful_sync()
    nodes_to_update = _find_nodes_to_update(last_sync)
    new_nodes = _find_new_nodes(last_sync)
    return list(nodes_to_update) + list(new_nodes)