后端第一步开发完成,第一版回归测试完成

This commit is contained in:
Your Name
2026-01-31 19:09:48 +08:00
parent 11cef531bd
commit c9e75030af
26 changed files with 1686 additions and 184 deletions
+4 -2
View File
@@ -1,6 +1,8 @@
"""
认证 API 测试(依据 API 文档 2.1 登录)
TDD:先写失败用例,再实现路由
测试与开发环境严格隔离:通过 HTTP 请求已启动的后端服务,真实调用登录接口。
运行前请先启动后端:http://127.0.0.1:8000
"""
@@ -8,7 +10,7 @@ def test_login_success_returns_200_with_token_and_user(client):
"""正确账号密码返回 200 且包含 token 和 user"""
r = client.post(
"/api/auth/login",
json={"username": "market", "password": "valid-password"},
json={"username": "admin", "password": "123456"},
)
assert r.status_code == 200
body = r.json()