feat(админка): действия в карточке и тост отмены
This commit is contained in:
@@ -92,3 +92,16 @@ def test_undo_after_soft_delete_does_not_lie(env):
|
||||
assert "не найден" in r.json()["detail"]
|
||||
# состояние не помечено undone — откат не врёт
|
||||
assert db.get_admin_action(aid)["undone_at"] is None
|
||||
|
||||
|
||||
def test_admin_cannot_demote_or_block_self(env):
|
||||
db, client, h, auth = env
|
||||
for action, value in (("role", {"role": "user"}), ("block", {"blocked": True})):
|
||||
r = client.post("/api/admin/v2/customers/boss@x/action",
|
||||
json={"action": action, "value": value}, headers=h)
|
||||
assert r.status_code == 400
|
||||
assert db.get_user_by_email("boss@x")["role"] == "admin"
|
||||
assert db.get_user_by_email("boss@x")["blocked"] == 0
|
||||
assert client.post("/api/admin/v2/customers/boss@x/action",
|
||||
json={"action": "read_only", "value": {"read_only": True}},
|
||||
headers=h).status_code == 200
|
||||
|
||||
Reference in New Issue
Block a user