diff --git a/tests/test_database.py b/tests/test_database.py index 79eea7d..c8f16a4 100644 --- a/tests/test_database.py +++ b/tests/test_database.py @@ -442,6 +442,8 @@ def test_database_sync_clocks(): db = database.Database(":memory:", random_slug()) db.ensure_database_schema() + db_clock = db.get_clock() + other_origin = f"other_{random_slug()}" other_clock = db.get_sync_clock(other_origin) @@ -452,6 +454,9 @@ def test_database_sync_clocks(): other_clock = db.get_sync_clock(other_origin) assert other_clock == 1234 + # Sync table doesn't affect the clock. + assert db.get_clock() == db_clock + def test_database_do_sync(): db = database.Database(":memory:", random_slug()) @@ -484,3 +489,22 @@ def test_database_do_sync_conflict(): feeds = db.load_all(feed_limit=99999) assert feeds == [FEED, OTHER_FEED] + + +def test_database_no_change_no_clock(): + db = database.Database(":memory:", random_slug()) + db.ensure_database_schema() + + other = database.Database(":memory:", random_slug()) + other.ensure_database_schema() + + db.store_feed(FEED) + db.store_feed(OTHER_FEED) + other.store_feed(FEED) + other.store_feed(OTHER_FEED) + + db_clock = db.get_clock() + + db.sync_from(other) + + assert db.get_clock() == db_clock