chore: enforce ruff lint and format standards across backend
This commit is contained in:
parent
a8e312a4f8
commit
a6cc585dd0
39 changed files with 459 additions and 559 deletions
|
|
@ -40,9 +40,7 @@ async def _handoff_task(client, live_server, continuation_flow_id=None):
|
|||
}
|
||||
if continuation_flow_id is not None:
|
||||
body["continuation_flow_id"] = continuation_flow_id
|
||||
run = (
|
||||
await client.post(f"/api/flows/{flow['id']}/run", json=body)
|
||||
).json()
|
||||
run = (await client.post(f"/api/flows/{flow['id']}/run", json=body)).json()
|
||||
assert run["status"] == "pending_approval"
|
||||
tasks = (await client.get("/api/approvals")).json()
|
||||
task = next(t for t in tasks if t["run_id"] == run["id"])
|
||||
|
|
@ -67,9 +65,7 @@ async def test_approve_with_continuation_runs_facts(client, lfx_server, live_ser
|
|||
cont = await _create_flow(client, f"cont-{uuid4().hex[:8]}")
|
||||
await _version_and_deploy(client, cont["id"], fixture="simple_rule.json")
|
||||
|
||||
_, task = await _handoff_task(
|
||||
client, live_server, continuation_flow_id=cont["id"]
|
||||
)
|
||||
_, task = await _handoff_task(client, live_server, continuation_flow_id=cont["id"])
|
||||
assert task["continuation_flow_id"] == cont["id"]
|
||||
|
||||
response = await client.post(
|
||||
|
|
@ -109,9 +105,7 @@ async def test_decision_guards(client, lfx_server, live_server):
|
|||
response = await client.post(url, json={"decision": "reject"})
|
||||
assert response.status_code == 409
|
||||
|
||||
response = await client.post(
|
||||
f"/api/approvals/{uuid4()}/decision", json={"decision": "approve"}
|
||||
)
|
||||
response = await client.post(f"/api/approvals/{uuid4()}/decision", json={"decision": "approve"})
|
||||
assert response.status_code == 404
|
||||
|
||||
_, task2 = await _handoff_task(client, live_server)
|
||||
|
|
@ -143,17 +137,13 @@ async def test_decision_bad_continuation_reference(client, session):
|
|||
flow_store.get_version(session, UUID(version["id"])),
|
||||
input={},
|
||||
)
|
||||
task = flow_store.create_approval_task(
|
||||
session, ApprovalCreate(run_id=run.id, title="t")
|
||||
)
|
||||
task = flow_store.create_approval_task(session, ApprovalCreate(run_id=run.id, title="t"))
|
||||
# plant unknown continuation directly (store allows it pre-validation)
|
||||
task.continuation_flow_id = uuid4()
|
||||
session.add(task)
|
||||
session.commit()
|
||||
|
||||
response = await client.post(
|
||||
f"/api/approvals/{task.id}/decision", json={"decision": "approve"}
|
||||
)
|
||||
response = await client.post(f"/api/approvals/{task.id}/decision", json={"decision": "approve"})
|
||||
assert response.status_code == 422
|
||||
|
||||
|
||||
|
|
@ -168,9 +158,7 @@ async def test_tenant_isolation(client, lfx_server):
|
|||
)
|
||||
assert response.status_code == 200
|
||||
|
||||
response = await client.get(
|
||||
f"/api/flows/{flow['id']}/runs", params={"tenant_id": "pfarramt-a"}
|
||||
)
|
||||
response = await client.get(f"/api/flows/{flow['id']}/runs", params={"tenant_id": "pfarramt-a"})
|
||||
runs_a = response.json()
|
||||
assert len(runs_a) == 1
|
||||
assert runs_a[0]["tenant_id"] == "pfarramt-a"
|
||||
|
|
@ -206,9 +194,7 @@ async def test_lfx_down_maps_to_503(client, lfx_server, monkeypatch):
|
|||
deployed = await client.post(f"/api/flows/{flow['id']}/versions/1/deploy")
|
||||
assert deployed.status_code == 200
|
||||
monkeypatch.setattr(settings, "lfx_url", "http://127.0.0.1:9")
|
||||
response = await client.post(
|
||||
f"/api/flows/{flow['id']}/run", json={"input": {"betrag": 1}}
|
||||
)
|
||||
response = await client.post(f"/api/flows/{flow['id']}/run", json={"input": {"betrag": 1}})
|
||||
assert response.status_code == 503
|
||||
|
||||
|
||||
|
|
@ -221,9 +207,7 @@ async def test_lfx_drift_maps_to_502(client, lfx_server):
|
|||
await LfxClient(settings.lfx_url, api_key=settings.lfx_api_key or None).delete_flow(
|
||||
deployed["lfx_flow_id"]
|
||||
)
|
||||
response = await client.post(
|
||||
f"/api/flows/{flow['id']}/run", json={"input": {"betrag": 1}}
|
||||
)
|
||||
response = await client.post(f"/api/flows/{flow['id']}/run", json={"input": {"betrag": 1}})
|
||||
assert response.status_code == 502
|
||||
|
||||
|
||||
|
|
@ -247,9 +231,7 @@ async def test_corrupt_flow_json_deploy_maps_to_422(client, lfx_server):
|
|||
"edges": [],
|
||||
},
|
||||
}
|
||||
response = await client.post(
|
||||
f"/api/flows/{flow['id']}/versions", json={"langflow_json": bogus}
|
||||
)
|
||||
response = await client.post(f"/api/flows/{flow['id']}/versions", json={"langflow_json": bogus})
|
||||
assert response.status_code == 201, response.text
|
||||
response = await client.post(f"/api/flows/{flow['id']}/versions/1/deploy")
|
||||
assert response.status_code == 422
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue