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:
@@ -41,9 +41,9 @@ def test_create_message_roundtrip(live_app):
|
||||
headers=auth,
|
||||
timeout=30,
|
||||
)
|
||||
assert status in (200, 201) and isinstance(team, dict) and team.get("id"), (
|
||||
f"team creation failed: HTTP {status}, body={team!r}"
|
||||
)
|
||||
assert (
|
||||
status in (200, 201) and isinstance(team, dict) and team.get("id")
|
||||
), f"team creation failed: HTTP {status}, body={team!r}"
|
||||
status, chan = harness_http.http_post(
|
||||
f"{base}/channels",
|
||||
data={
|
||||
@@ -55,9 +55,9 @@ def test_create_message_roundtrip(live_app):
|
||||
headers=auth,
|
||||
timeout=30,
|
||||
)
|
||||
assert status in (200, 201) and isinstance(chan, dict) and chan.get("id"), (
|
||||
f"channel creation failed: HTTP {status}, body={chan!r}"
|
||||
)
|
||||
assert (
|
||||
status in (200, 201) and isinstance(chan, dict) and chan.get("id")
|
||||
), f"channel creation failed: HTTP {status}, body={chan!r}"
|
||||
|
||||
# 4) POST a unique marker message.
|
||||
marker = f"ccci-marker-{uniq}-roundtrip"
|
||||
@@ -67,13 +67,13 @@ def test_create_message_roundtrip(live_app):
|
||||
headers=auth,
|
||||
timeout=30,
|
||||
)
|
||||
assert status in (200, 201) and isinstance(post, dict) and post.get("id"), (
|
||||
f"post creation failed: HTTP {status}, body={post!r}"
|
||||
)
|
||||
assert (
|
||||
status in (200, 201) and isinstance(post, dict) and post.get("id")
|
||||
), f"post creation failed: HTTP {status}, body={post!r}"
|
||||
|
||||
# 5) Read it back by id and assert the message survived the round-trip.
|
||||
status, got = harness_http.http_get(f"{base}/posts/{post['id']}", headers=auth, timeout=30)
|
||||
assert status == 200 and isinstance(got, dict), f"read-back failed: HTTP {status}, body={got!r}"
|
||||
assert got.get("message") == marker, (
|
||||
f"message did not round-trip: sent {marker!r}, got {got.get('message')!r}"
|
||||
)
|
||||
assert (
|
||||
got.get("message") == marker
|
||||
), f"message did not round-trip: sent {marker!r}, got {got.get('message')!r}"
|
||||
|
||||
@@ -18,9 +18,7 @@ from harness import http as harness_http # noqa: E402
|
||||
def test_root_serves(live_app):
|
||||
"""GET / → 200 or 302 (mattermost web app shell / login redirect)."""
|
||||
url = f"https://{live_app}/"
|
||||
status, _ = harness_http.retry_http_get(
|
||||
url, expect_status=(200, 302), max_wait=60, interval=3
|
||||
)
|
||||
status, _ = harness_http.retry_http_get(url, expect_status=(200, 302), max_wait=60, interval=3)
|
||||
assert status in (200, 302), f"GET {url} HTTP {status} (expected 200/302)"
|
||||
|
||||
|
||||
@@ -28,10 +26,8 @@ def test_system_ping_ok(live_app):
|
||||
"""GET /api/v4/system/ping → 200 with JSON {"status":"OK"} — the mattermost server's own
|
||||
liveness endpoint (distinguishes a live mattermost API from a Traefik fallback / dead backend)."""
|
||||
url = f"https://{live_app}/api/v4/system/ping"
|
||||
status, body = harness_http.retry_http_get(
|
||||
url, expect_status=200, max_wait=120, interval=3
|
||||
)
|
||||
status, body = harness_http.retry_http_get(url, expect_status=200, max_wait=120, interval=3)
|
||||
assert status == 200, f"GET {url} HTTP {status} (expected 200)"
|
||||
assert isinstance(body, dict) and body.get("status") == "OK", (
|
||||
f"/api/v4/system/ping did not report status=OK; got {body!r}"
|
||||
)
|
||||
assert (
|
||||
isinstance(body, dict) and body.get("status") == "OK"
|
||||
), f"/api/v4/system/ping did not report status=OK; got {body!r}"
|
||||
|
||||
@@ -51,7 +51,12 @@ def test_second_user_reads_first_users_message(live_app):
|
||||
assert status in (200, 201) and team.get("id"), f"team create HTTP {status}: {team!r}"
|
||||
status, chan = harness_http.http_post(
|
||||
f"{base}/channels",
|
||||
data={"team_id": team["id"], "name": f"c{uniq}", "display_name": f"chan {uniq}", "type": "O"},
|
||||
data={
|
||||
"team_id": team["id"],
|
||||
"name": f"c{uniq}",
|
||||
"display_name": f"chan {uniq}",
|
||||
"type": "O",
|
||||
},
|
||||
headers=auth_a,
|
||||
timeout=30,
|
||||
)
|
||||
@@ -60,7 +65,10 @@ def test_second_user_reads_first_users_message(live_app):
|
||||
# 2) user_a posts a unique marker
|
||||
marker = f"ccci-multiuser-{uniq}"
|
||||
status, post = harness_http.http_post(
|
||||
f"{base}/posts", data={"channel_id": chan["id"], "message": marker}, headers=auth_a, timeout=30
|
||||
f"{base}/posts",
|
||||
data={"channel_id": chan["id"], "message": marker},
|
||||
headers=auth_a,
|
||||
timeout=30,
|
||||
)
|
||||
assert status in (200, 201) and post.get("id"), f"post create HTTP {status}: {post!r}"
|
||||
|
||||
@@ -97,6 +105,6 @@ def test_second_user_reads_first_users_message(live_app):
|
||||
|
||||
# 5) user_b sees user_a's marker (cross-user delivery, not a self read-back)
|
||||
messages = [p.get("message") for p in (posts.get("posts") or {}).values()]
|
||||
assert marker in messages, (
|
||||
f"user_b did not see user_a's message {marker!r} in the channel; saw {messages!r}"
|
||||
)
|
||||
assert (
|
||||
marker in messages
|
||||
), f"user_b did not see user_a's message {marker!r} in the channel; saw {messages!r}"
|
||||
|
||||
Reference in New Issue
Block a user