From bfa76cd90279171fd132c16d9aa9912b0a45aa8d Mon Sep 17 00:00:00 2001 From: cfdaily Date: Mon, 18 May 2026 16:13:54 +0800 Subject: [PATCH] auto-sync: 2026-05-18 16:13:54 --- tests/test_e2e_v27.py | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/tests/test_e2e_v27.py b/tests/test_e2e_v27.py index d7dc8ca..e97e42a 100644 --- a/tests/test_e2e_v27.py +++ b/tests/test_e2e_v27.py @@ -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