update
This commit is contained in:
@@ -85,3 +85,34 @@ async def test_scan_409_bei_dirty_tree(client):
|
||||
r = await c.post("/api/projekte/mini/scan", json={"art": "scan"})
|
||||
assert r.status_code == 409
|
||||
assert "uncommittete" in r.json()["detail"]
|
||||
|
||||
|
||||
async def test_fs_browse(client, tmp_path):
|
||||
c, _, _ = client
|
||||
(tmp_path / "unter" / ".planer").mkdir(parents=True)
|
||||
(tmp_path / ".versteckt").mkdir()
|
||||
r = await c.get("/api/fs", params={"pfad": str(tmp_path)})
|
||||
daten = r.json()
|
||||
assert daten["pfad"] == str(tmp_path.resolve())
|
||||
assert daten["eltern"] == str(tmp_path.resolve().parent)
|
||||
ordner = {o["name"]: o for o in daten["ordner"]}
|
||||
assert ordner["unter"]["hat_planer"] is True
|
||||
assert ".versteckt" not in ordner
|
||||
assert (await c.get("/api/fs", params={"pfad": str(tmp_path / "fehlt")})).status_code == 404
|
||||
|
||||
|
||||
async def test_projekt_hinzufuegen_und_entfernen(client, tmp_path):
|
||||
c, _, _ = client
|
||||
neu = tmp_path / "neues-repo"
|
||||
(neu / ".planer").mkdir(parents=True)
|
||||
|
||||
assert (await c.post("/api/projekte", json={"pfad": str(neu)})).status_code == 200
|
||||
namen = [p["name"] for p in (await c.get("/api/projekte")).json()]
|
||||
assert "neues-repo" in namen and "mini" in namen
|
||||
assert (await c.post("/api/projekte", json={"pfad": str(neu)})).status_code == 409
|
||||
|
||||
assert (await c.delete("/api/projekte/neues-repo")).status_code == 200
|
||||
namen = [p["name"] for p in (await c.get("/api/projekte")).json()]
|
||||
assert "neues-repo" not in namen and "mini" in namen
|
||||
assert (neu / ".planer").is_dir() # Artefakte bleiben erhalten
|
||||
assert (await c.delete("/api/projekte/neues-repo")).status_code == 404
|
||||
|
||||
Reference in New Issue
Block a user