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:
@@ -28,7 +28,8 @@ import sys
|
||||
import pytest
|
||||
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "..", "runner"))
|
||||
from harness import http as harness_http, sso # noqa: E402
|
||||
from harness import http as harness_http # noqa: E402
|
||||
from harness import sso
|
||||
|
||||
|
||||
def _b64url(seg: str) -> bytes:
|
||||
@@ -74,33 +75,40 @@ def test_create_room_get_livekit_token_and_read_back(live_app, deps_creds):
|
||||
lk_room = livekit.get("room")
|
||||
lk_token = livekit.get("token")
|
||||
assert room_id, f"room created but no id: {body!r}"
|
||||
assert lk_token and isinstance(lk_token, str) and lk_token.count(".") == 2, (
|
||||
f"room created but no LiveKit JWT token: {livekit!r}"
|
||||
)
|
||||
assert (
|
||||
lk_token and isinstance(lk_token, str) and lk_token.count(".") == 2
|
||||
), f"room created but no LiveKit JWT token: {livekit!r}"
|
||||
|
||||
try:
|
||||
# --- read it back (a fresh authenticated GET of the created room) ---
|
||||
status, got = harness_http.http_request("GET", f"{base}/api/v1.0/rooms/{room_id}/", headers=auth)
|
||||
status, got = harness_http.http_request(
|
||||
"GET", f"{base}/api/v1.0/rooms/{room_id}/", headers=auth
|
||||
)
|
||||
assert status == 200, f"room read-back returned HTTP {status} (expected 200); body={got!r}"
|
||||
assert isinstance(got, dict) and got.get("id") == room_id, (
|
||||
f"read-back room id mismatch: {got!r}"
|
||||
)
|
||||
got_lk = (got.get("livekit") or {})
|
||||
assert (
|
||||
isinstance(got, dict) and got.get("id") == room_id
|
||||
), f"read-back room id mismatch: {got!r}"
|
||||
got_lk = got.get("livekit") or {}
|
||||
assert got_lk.get("token"), f"read-back room missing LiveKit token: {got!r}"
|
||||
assert got_lk.get("room") == lk_room, (
|
||||
f"read-back LiveKit room {got_lk.get('room')!r} != create-time {lk_room!r}"
|
||||
)
|
||||
assert (
|
||||
got_lk.get("room") == lk_room
|
||||
), f"read-back LiveKit room {got_lk.get('room')!r} != create-time {lk_room!r}"
|
||||
|
||||
# --- the LiveKit token is a real signaling grant for this room (WebRTC subset) ---
|
||||
payload = json.loads(_b64url(lk_token.split(".")[1]))
|
||||
video = payload.get("video") or {}
|
||||
assert video.get("room") == lk_room or payload.get("room") == lk_room, (
|
||||
f"LiveKit JWT does not grant the created room {lk_room!r}: {payload!r}"
|
||||
)
|
||||
assert (
|
||||
video.get("room") == lk_room or payload.get("room") == lk_room
|
||||
), f"LiveKit JWT does not grant the created room {lk_room!r}: {payload!r}"
|
||||
finally:
|
||||
# --- delete the room (cleanup + a real DELETE mutation) ---
|
||||
del_status, _ = harness_http.http_request("DELETE", f"{base}/api/v1.0/rooms/{room_id}/", headers=auth)
|
||||
assert del_status in (204, 200), f"room delete returned HTTP {del_status} (expected 204/200)"
|
||||
del_status, _ = harness_http.http_request(
|
||||
"DELETE", f"{base}/api/v1.0/rooms/{room_id}/", headers=auth
|
||||
)
|
||||
assert del_status in (
|
||||
204,
|
||||
200,
|
||||
), f"room delete returned HTTP {del_status} (expected 204/200)"
|
||||
|
||||
# --- best-effort: confirm the delete took (404 on re-GET). The §4.3 floor (create-an-object +
|
||||
# read-it-back + LiveKit-token issuance) is already proven by the hard assertions above; this
|
||||
@@ -112,7 +120,9 @@ def test_create_room_get_livekit_token_and_read_back(live_app, deps_creds):
|
||||
|
||||
gone = False
|
||||
for _ in range(5):
|
||||
status, _ = harness_http.http_request("GET", f"{base}/api/v1.0/rooms/{room_id}/", headers=auth)
|
||||
status, _ = harness_http.http_request(
|
||||
"GET", f"{base}/api/v1.0/rooms/{room_id}/", headers=auth
|
||||
)
|
||||
if status == 404:
|
||||
gone = True
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user