auto-sync: 2026-05-18 16:13:54

This commit is contained in:
cfdaily
2026-05-18 16:13:54 +08:00
parent 06e9b15f06
commit bfa76cd902
+10 -16
View File
@@ -59,7 +59,7 @@ def _tid() -> str:
class TestE1ProjectManagement:
"""E1: 项目创建、列表、归档"""
def test_e11_create_project(self, client):
def test_e11_create_and_get_project(self, client):
pid = _pid()
resp = client.post("/api/projects", json={
"id": pid,
@@ -69,8 +69,11 @@ class TestE1ProjectManagement:
assert resp.status_code == 200
data = resp.json()
assert data.get("project_id") == pid or data.get("id") == pid
# 清理
self._pid = pid
# 获取
resp = client.get(f"/api/projects/{pid}")
assert resp.status_code == 200
assert resp.json().get("id") == pid
def test_e12_list_projects(self, client):
resp = client.get("/api/projects")
@@ -79,25 +82,16 @@ class TestE1ProjectManagement:
assert "projects" in data
assert isinstance(data["projects"], dict)
def test_e13_get_project(self, client):
pid = getattr(self, "_pid", None)
if not pid:
pytest.skip("No project created")
resp = client.get(f"/api/projects/{pid}")
assert resp.status_code == 200
assert resp.json().get("id") == pid or resp.json().get("project_id") == pid
def test_e14_archive_project(self, client):
pid = getattr(self, "_pid", None)
if not pid:
pytest.skip("No project created")
def test_e13_archive_project(self, client):
pid = _pid()
client.post("/api/projects", json={"id": pid, "name": f"Archive-{pid}"})
resp = client.post(f"/api/projects/{pid}/archive")
assert resp.status_code == 200
# 验证状态
resp = client.get(f"/api/projects/{pid}")
assert resp.json()["status"] == "archived"
def test_e15_create_project_auto_discover(self, data_root):
def test_e14_create_project_auto_discover(self, data_root):
"""创建含 blackboard.db 的目录,验证自动发现"""
pid = _pid()
project_dir = data_root / pid