Couple more tests
This commit is contained in:
parent
74e9091065
commit
fccb55b7f0
1 changed files with 24 additions and 0 deletions
|
|
@ -442,6 +442,8 @@ def test_database_sync_clocks():
|
||||||
db = database.Database(":memory:", random_slug())
|
db = database.Database(":memory:", random_slug())
|
||||||
db.ensure_database_schema()
|
db.ensure_database_schema()
|
||||||
|
|
||||||
|
db_clock = db.get_clock()
|
||||||
|
|
||||||
other_origin = f"other_{random_slug()}"
|
other_origin = f"other_{random_slug()}"
|
||||||
|
|
||||||
other_clock = db.get_sync_clock(other_origin)
|
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)
|
other_clock = db.get_sync_clock(other_origin)
|
||||||
assert other_clock == 1234
|
assert other_clock == 1234
|
||||||
|
|
||||||
|
# Sync table doesn't affect the clock.
|
||||||
|
assert db.get_clock() == db_clock
|
||||||
|
|
||||||
|
|
||||||
def test_database_do_sync():
|
def test_database_do_sync():
|
||||||
db = database.Database(":memory:", random_slug())
|
db = database.Database(":memory:", random_slug())
|
||||||
|
|
@ -484,3 +489,22 @@ def test_database_do_sync_conflict():
|
||||||
|
|
||||||
feeds = db.load_all(feed_limit=99999)
|
feeds = db.load_all(feed_limit=99999)
|
||||||
assert feeds == [FEED, OTHER_FEED]
|
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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue