fix(files): a folder's kind is answered before its new name, as before

A blank name on a source folder answered 400 name_required; it answers 409
not_own again.
This commit is contained in:
2026-10-20 00:45:22 +02:00
parent 8206384c91
commit b376373af5
3 changed files with 12 additions and 1 deletions
+3
View File
@@ -124,6 +124,9 @@ def test_only_an_own_folder_is_renamed_and_only_by_its_user(db, make_user, as_us
assert clash.json()["detail"]["reason"] == "file_folder_name_taken"
no = c.patch(f"/api/files/folders/{src.id}", json={"name": "YouTube 2"})
assert no.status_code == 409 and no.json()["detail"]["reason"] == "file_folder_not_own"
# Which folder is answered before what the name is: a blank one is still "not yours to name".
blank = c.patch(f"/api/files/folders/{src.id}", json={"name": " "})
assert blank.status_code == 409 and blank.json()["detail"]["reason"] == "file_folder_not_own"
stranger = as_user(make_user()).patch(f"/api/files/folders/{own.id}", json={"name": "X"})
assert stranger.status_code == 404
db.refresh(own)