完善设备端体验与微信校验支持

This commit is contained in:
stu2not
2026-07-07 16:58:05 +08:00
parent b4fef6d2e0
commit 937e3023fc
38 changed files with 3377 additions and 51 deletions

View File

@@ -0,0 +1,22 @@
import pytest
from httpx import ASGITransport, AsyncClient
from main import app
@pytest.mark.asyncio
async def test_wechat_verify_file_served_at_root():
async with AsyncClient(transport=ASGITransport(app=app), base_url="http://testserver") as client:
response = await client.get("/HXNd3XMbPq.txt")
assert response.status_code == 200
assert response.text == "60756bcfc3d838155f64397bec395a44"
assert response.headers["content-type"].startswith("text/plain")
@pytest.mark.asyncio
async def test_unknown_root_txt_file_is_not_exposed():
async with AsyncClient(transport=ASGITransport(app=app), base_url="http://testserver") as client:
response = await client.get("/unknown-wechat-verify.txt")
assert response.status_code == 404