test: отказ — одна причина без пересказа вопроса, значок «Баланс исчерпан»
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -266,3 +266,22 @@ def test_admin_endpoint_requires_admin(env):
|
||||
r = client.post("/api/admin/users/read-only", headers=h,
|
||||
json={"email": "u@x", "read_only": False})
|
||||
assert r.status_code == 403
|
||||
|
||||
|
||||
def test_limits_report_read_only(env):
|
||||
# Значок остатка не должен показывать «Осталось: 169 ₽» рядом с отказом «баланс
|
||||
# исчерпан» (снимок 30.09.2026).
|
||||
db, auth, main, client = env
|
||||
h = _hdr(auth, db, "ro@x")
|
||||
assert client.get("/api/limits", headers=h).json().get("read_only") in (None, False)
|
||||
db.set_read_only("ro@x", True)
|
||||
assert client.get("/api/limits", headers=h).json()["read_only"] is True
|
||||
|
||||
|
||||
def test_badge_says_balance_exhausted_in_read_only():
|
||||
html = open(os.path.join(ROOT, "static", "chat.html"), encoding="utf-8").read()
|
||||
i = html.index("function renderBalance(b) {")
|
||||
block = html[i:i + 700]
|
||||
assert "if (b.read_only) {" in block and "'Баланс исчерпан'" in block
|
||||
j = html.index("function openBalancePopover() {")
|
||||
assert "if (b.read_only) {" in html[j:j + 1800]
|
||||
|
||||
Reference in New Issue
Block a user