From f62d6bf9d6e28083eeb16f1434192eb0274efe3b Mon Sep 17 00:00:00 2001 From: ThearchyHelios Date: Mon, 5 Oct 2026 18:57:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A1=E6=89=B9=E8=B4=A8=E8=AF=A2=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=EF=BC=9A=E7=BD=B2=E5=90=8D=E7=85=A7=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E5=A4=B4=E8=AE=B0=EF=BC=9B=E5=86=99=E8=BF=87=E7=9A=84=E6=A0=B8?= =?UTF-8?q?=E6=9F=A5=E8=AE=BE=E7=BD=AE=E5=92=8C=E8=8A=B1=E8=B4=B9=E8=B4=A6?= =?UTF-8?q?=E5=9C=A8=E6=B5=8B=E8=AF=95=E7=BB=93=E6=9D=9F=E6=97=B6=E6=B8=85?= =?UTF-8?q?=E6=8E=89=EF=BC=8C=E4=B8=8D=E7=95=99=E7=BB=99=E5=90=8C=E4=B8=80?= =?UTF-8?q?=E8=BF=9B=E7=A8=8B=E9=87=8C=E5=90=8E=E9=9D=A2=E7=9A=84=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/tests/test_inquiry_api.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/backend/tests/test_inquiry_api.py b/backend/tests/test_inquiry_api.py index 98bf870d..811dda00 100644 --- a/backend/tests/test_inquiry_api.py +++ b/backend/tests/test_inquiry_api.py @@ -64,15 +64,21 @@ NOT_RECORDED = "运行状态已经变化,这次质询的问答没有写入运 BUSY_DECIDE = {"detail": "正在回答质询,回答完再批准或驳回", "code": "inquiry_busy"} -@pytest.fixture(autouse=True) -async def engine_up(): - await run_manager.setup() +async def _clean_settings() -> None: async with SessionLocal() as session: await session.execute(delete(Setting).where(Setting.key.in_( [spend.SPEND_KEY, JUDGE_SPEND_KEY, "verify", "judge", "copilot"]))) await session.commit() + + +@pytest.fixture(autouse=True) +async def engine_up(): + await run_manager.setup() + await _clean_settings() yield await run_manager.shutdown() + # 这里写过的核查设置、花费账不留给同一进程里后面的测试文件 + await _clean_settings() @pytest.fixture @@ -743,8 +749,11 @@ async def test_listing_filters_by_report_and_sentence_and_artifacts_are_whitelis [approval] = await pending(paused.id) doc = await report_doc(paused.id) east, south = unit_of(doc, EAST), unit_of(doc, SOUTH) - first = (await ask(client, paused.id, report="write", unit=east, question=QUESTION, - approval_id=approval.id)).json()["inquiry"] + # 署名照请求头记(前端按 encodeURIComponent 编码后发) + first = (await client.post(f"/api/runs/{paused.id}/inquiries", headers={"X-Actor": "%E5%BC%A0%E5%B7%A5"}, + json={"report": "write", "unit": east, "question": QUESTION, + "approval_id": approval.id})).json()["inquiry"] + assert first["actor"] == "张工" second = (await ask(client, paused.id, report="write", unit=south, question="华南为什么低?", approval_id=approval.id)).json()["inquiry"] assert first["seq"] < second["seq"]