feat: 服务端集成自动打包流程

This commit is contained in:
shen
2026-07-17 22:34:04 +08:00
parent a2437a039d
commit d1f070b251
221 changed files with 7284 additions and 447 deletions
+6 -3
View File
@@ -20,15 +20,18 @@ from backend.database import init_db, engine, Base
def setup_db():
"""每个测试前重建数据库"""
Base.metadata.drop_all(bind=engine)
Base.metadata.create_all(bind=engine)
init_db()
yield
Base.metadata.drop_all(bind=engine)
@pytest.fixture
def client():
"""FastAPI 测试客户端"""
return TestClient(app)
"""已登录的 FastAPI 测试客户端"""
test_client = TestClient(app)
response = test_client.post("/api/auth/login", json={"username": "admin", "password": "admin123"})
test_client.headers.update({"Authorization": f"Bearer {response.json()['token']}"})
return test_client
@pytest.fixture