fix(админка): восстановление по архивному имени и reload

This commit is contained in:
anor
2026-11-06 22:09:54 +10:00
parent 7c98e0a832
commit 19834cd1dc
3 changed files with 19 additions and 5 deletions
+5 -2
View File
@@ -73,9 +73,12 @@ def test_delete_and_restore_from_card(env):
db, client, h, auth, data = env
r = client.post("/api/admin/v2/customers/joe@x/delete", headers=h)
assert r.status_code == 200, r.text
assert r.json()["archived_as"].startswith("joe@x#deleted-")
archived = r.json()["archived_as"]
assert archived.startswith("joe@x#deleted-")
assert client.post("/api/admin/v2/customers/joe@x/delete", headers=h).status_code == 404
assert client.post("/api/admin/v2/customers/joe@x/restore", headers=h).status_code == 200
# восстановление по архивному имени — именно так открыта карточка удалённого
assert client.post("/api/admin/v2/customers/" + quote(archived, safe="") + "/restore",
headers=h).status_code == 200
assert db.get_user_by_email("joe@x")["deleted_at"] is None
assert client.post("/api/admin/v2/customers/joe@x/restore", headers=h).status_code == 404