🤖 ldap2nextcloud : synchronisation LDAP vers un carnet Nextcloud (CardDAV)
Historique regroupé en un seul commit pour ne pas publier de données de production. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
f6a01b85e1
42 files changed
+5538
No files matched your search
@@ -0,0 +1,43 @@
|
||||
from ldap2nextcloud.state import StateDB, StateRow
|
||||
|
||||
ROW = StateRow(href="a.vcf", key="alice", fingerprint="f1", etag="e1")
|
||||
|
||||
|
||||
def test_upsert_then_all(tmp_path):
|
||||
with StateDB(tmp_path / "s.sqlite") as db:
|
||||
db.upsert(ROW)
|
||||
assert db.all() == {"a.vcf": ROW}
|
||||
|
||||
|
||||
def test_upsert_overwrites(tmp_path):
|
||||
with StateDB(tmp_path / "s.sqlite") as db:
|
||||
db.upsert(ROW)
|
||||
db.upsert(StateRow("a.vcf", "alice", "f2", None))
|
||||
assert db.all()["a.vcf"] == StateRow("a.vcf", "alice", "f2", None)
|
||||
|
||||
|
||||
def test_set_etag(tmp_path):
|
||||
with StateDB(tmp_path / "s.sqlite") as db:
|
||||
db.upsert(StateRow("a.vcf", "alice", "f1", None))
|
||||
db.set_etag("a.vcf", "e9")
|
||||
assert db.all()["a.vcf"].etag == "e9"
|
||||
|
||||
|
||||
def test_delete(tmp_path):
|
||||
with StateDB(tmp_path / "s.sqlite") as db:
|
||||
db.upsert(ROW)
|
||||
db.delete("a.vcf")
|
||||
assert db.all() == {}
|
||||
|
||||
|
||||
def test_persists_across_reopen(tmp_path):
|
||||
with StateDB(tmp_path / "s.sqlite") as db:
|
||||
db.upsert(ROW)
|
||||
with StateDB(tmp_path / "s.sqlite") as db:
|
||||
assert db.all() == {"a.vcf": ROW}
|
||||
|
||||
|
||||
def test_creates_parent_directory(tmp_path):
|
||||
with StateDB(tmp_path / "state" / "deep" / "s.sqlite") as db:
|
||||
db.upsert(ROW)
|
||||
assert (tmp_path / "state" / "deep" / "s.sqlite").is_file()
|
||||
Reference in new issue
Block a user