iOSBuildServer/tests/test_api_auth.py
shen 6f4f625c56 Initial commit: iOS Build Server
- FastAPI backend with build queue, WebSocket logs, task management
- Vue 3 frontend with build/config/history views
- Xcode project build automation with IPA export
- Fix: initialize build_dir before try block to ensure cleanup on early failure
2026-06-06 17:42:27 +08:00

20 lines
627 B
Python

"""认证接口测试"""
def test_login_success(client):
resp = client.post("/api/auth/login", json={"username": "admin", "password": "admin123"})
assert resp.status_code == 200
data = resp.json()
assert data["token"] == "admin-token"
assert data["is_admin"] is True
def test_login_wrong_password(client):
resp = client.post("/api/auth/login", json={"username": "admin", "password": "wrong"})
assert resp.status_code == 401
def test_login_wrong_username(client):
resp = client.post("/api/auth/login", json={"username": "nobody", "password": "admin123"})
assert resp.status_code == 401