- 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
20 lines
627 B
Python
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
|