feat: menu contextuel Déplacer/Dupliquer sidebar + réparation drag & drop interne #201 #BUG-117
CI / lint (push) Successful in 3m13s
CI / security (push) Successful in 1m59s
CI / test (push) Successful in 5m16s
CI / build (push) Successful in 1m52s
CI / e2e (push) Successful in 18m2s

This commit is contained in:
2026-10-15 10:02:48 -04:00
parent ed9029d760
commit 411667fd88
19 changed files with 314 additions and 20 deletions
+35 -1
View File
@@ -1002,4 +1002,38 @@ class TestStaticCaching:
def test_static_asset_revalidates(self, client):
resp = client.get("/static/style.css")
assert resp.status_code == 200
assert "no-cache" in resp.headers.get("cache-control", "")
assert "no-cache" in resp.headers.get("cache-control", "")
class TestDuplicateApi:
"""BUG-117 : endpoint POST /api/duplicate — copie fichiers/répertoires."""
def test_duplicate_file_and_collision(self, client):
r = client.post("/api/duplicate/TestVault", json={"source_path": "note1.md", "destination_dir": ""})
assert r.status_code == 200
assert r.json()["new_path"] == "note1 copie.md"
# collision -> copie 2
r2 = client.post("/api/duplicate/TestVault", json={"source_path": "note1.md", "destination_dir": ""})
assert r2.json()["new_path"] == "note1 copie 2.md"
orig = client.get("/api/file/TestVault", params={"path": "note1.md"}).json()["html"]
copy = client.get("/api/file/TestVault", params={"path": "note1 copie.md"}).json()["html"]
assert copy == orig
def test_duplicate_directory_into_target_and_index(self, client):
assert client.post("/api/directory/TestVault", json={"path": "notes/sub"}).status_code == 200
assert client.post("/api/file/TestVault", json={"path": "notes/a.md", "content": "secret note A"}).status_code == 200
r = client.post("/api/duplicate/TestVault", json={"source_path": "notes", "destination_dir": "Projets"})
assert r.status_code == 200
new = r.json()["new_path"]
assert new == "Projets/notes copie"
paths = [p["path"] for p in client.get("/api/vault/TestVault/paths").json()["results"]]
assert any(p.startswith(new + "/") for p in paths), "copy not indexed"
def test_duplicate_directory_inside_itself_rejected(self, client):
assert client.post("/api/directory/TestVault", json={"path": "notes"}).status_code == 200
r = client.post("/api/duplicate/TestVault", json={"source_path": "notes", "destination_dir": "notes"})
assert r.status_code == 400
def test_duplicate_not_found(self, client):
r = client.post("/api/duplicate/TestVault", json={"source_path": "nonexistent.md", "destination_dir": ""})
assert r.status_code == 404