Files
Hulumath-Web/backend/common/test_frontend_assets.py
T
Jacky 8aad781581
CI / test (pull_request) Canceled after 1m25s
PR合并自动部署 / release-check (pull_request) Successful in 1m44s
PR合并自动部署 / deploy (pull_request) Failing after 10s
fix: support idempotent actions over HTTP
2026-08-09 00:20:48 +08:00

23 lines
787 B
Python

from pathlib import Path
from django.conf import settings
STATIC_ROOT = Path(settings.BASE_DIR) / "static"
def test_app_js_幂等键兼容非安全上下文():
source = (STATIC_ROOT / "js" / "app.js").read_text(encoding="utf-8")
assert "function createIdempotencyKey()" in source
assert "crypto.randomUUID()" not in source
assert source.count('"Idempotency-Key": createIdempotencyKey()') == 2
def test_app_css_答题提交按钮可见且长弹窗可滚动():
source = (STATIC_ROOT / "css" / "app.css").read_text(encoding="utf-8")
assert ".choice-list .primary-button" in source
assert "background: var(--green); color: white; text-align: center" in source
assert "max-height: calc(100dvh - 30px)" in source
assert "overflow-y: auto" in source