style: repo-wide lint pass — make the lint gate green again

Push builds have been RED on the lint step since ~build 209 from accumulated
formatting drift. This is the mechanical cleanup: ruff format + ruff --fix
(UP038 isinstance unions, SIM105 contextlib.suppress, UP031 f-strings, SIM115
tempfile context manager), shfmt -i 2 -ci, nixpkgs-fmt/statix/deadnix (merged
attrsets, dropped unused lib args), yamllint, and shell quoting fixes in
tests/lasuite-docs/setup_custom_tests.sh. No behaviour changes intended;
lint: PASS, unit tests: 138 passed.
This commit is contained in:
2026-06-09 21:56:15 +00:00
parent e76d4005ab
commit 9a7772563a
115 changed files with 952 additions and 660 deletions

View File

@ -91,6 +91,6 @@ def test_login_endpoint_returns_json(live_app):
assert body is not None, f"/rest/login returned no parseable JSON: state={state}"
# If it's a dict, it's the expected envelope; if it's a list, n8n shouldn't do that on this
# endpoint, but accept either; only reject obvious non-shapes.
assert isinstance(body, (dict, list)), (
f"/rest/login returned unexpected JSON type {type(body).__name__}: {body!r}"
)
assert isinstance(
body, dict | list
), f"/rest/login returned unexpected JSON type {type(body).__name__}: {body!r}"

View File

@ -72,9 +72,9 @@ def test_rest_settings_returns_json_with_known_keys(live_app):
# (e.g. version 3.2.0+2.20.6).
assert isinstance(body, dict), f"/rest/settings returned non-dict JSON: {type(body).__name__}"
data = body.get("data") if "data" in body else body
assert isinstance(data, dict), (
f"/rest/settings response missing 'data' envelope: keys={list(body.keys())[:10]}"
)
assert isinstance(
data, dict
), f"/rest/settings response missing 'data' envelope: keys={list(body.keys())[:10]}"
# Bootstrap keys the editor SPA relies on across versions:
# - `userManagement`: the auth-mode dict (whether owner-setup is needed, smtp/email mode).
# - `defaultLocale`: i18n bootstrap; present on every n8n install.

View File

@ -136,7 +136,9 @@ def _get_workflow(domain: str, cookie_header: str, workflow_id) -> dict:
return json.loads(resp.read())
except urllib.error.HTTPError as e:
body = e.read().decode(errors="replace")
raise AssertionError(f"GET /rest/workflows/{workflow_id} HTTP {e.code}: {body[:200]}") from e
raise AssertionError(
f"GET /rest/workflows/{workflow_id} HTTP {e.code}: {body[:200]}"
) from e
def test_workflow_create_and_read_back(live_app):
@ -172,18 +174,21 @@ def test_workflow_create_and_read_back(live_app):
# Read it back and prove the round-trip
fetched = _get_workflow(domain, cookie, workflow_id)
fpayload = fetched.get("data") if isinstance(fetched.get("data"), dict) else fetched
assert fpayload.get("id") in (workflow_id, str(workflow_id)), (
f"GET workflow id={fpayload.get('id')!r} != created id={workflow_id!r}"
)
assert fpayload.get("name") == name, (
f"workflow name didn't round-trip: created={name!r}, fetched={fpayload.get('name')!r}"
)
assert fpayload.get("id") in (
workflow_id,
str(workflow_id),
), f"GET workflow id={fpayload.get('id')!r} != created id={workflow_id!r}"
assert (
fpayload.get("name") == name
), f"workflow name didn't round-trip: created={name!r}, fetched={fpayload.get('name')!r}"
nodes = fpayload.get("nodes") or []
assert isinstance(nodes, list) and len(nodes) == 1, (
f"workflow nodes didn't round-trip: expected 1 node, got {len(nodes)}"
)
assert (
isinstance(nodes, list) and len(nodes) == 1
), f"workflow nodes didn't round-trip: expected 1 node, got {len(nodes)}"
node = nodes[0]
assert node.get("type") == "n8n-nodes-base.manualTrigger", (
f"node type didn't round-trip: {node.get('type')!r}"
)
assert node.get("name") == "Manual Trigger", f"node name didn't round-trip: {node.get('name')!r}"
assert (
node.get("type") == "n8n-nodes-base.manualTrigger"
), f"node type didn't round-trip: {node.get('type')!r}"
assert (
node.get("name") == "Manual Trigger"
), f"node name didn't round-trip: {node.get('name')!r}"