test-rooms¶
Integration tests for call-room route behaviour.
Tests in this module exercise the /call and /create-room
endpoints through the test client, focusing on redirect logic and
access control rather than rendered content. Socket.IO room state is
not seeded, so all room-access tests reflect the behaviour of an empty
rooms dictionary.
- tests.test_rooms.test_create_room_requires_login(client)¶
Create-room endpoint redirects unauthenticated requests to the login page.
Issues a
POST /create-roomwith no active session and follows the redirect chain. Asserts200 OKon the final response, confirming thatlogin_required()intercepted the request and the user was returned to a valid page (the login form) rather than receiving an error.- Parameters:
client (flask.testing.FlaskClient) – The test client provided by
client().
- tests.test_rooms.test_invalid_room_returns_404(client)¶
Call endpoint redirects to
/joinwhen the room code does not exist.Issues a
GET /call?room=FAKE-0000for a room code that has no correspondingRoomrow and asserts a302redirect. The redirect target is/joinrather than a true404, which is the application’s intended behaviour — an unknown room code is treated as a user error rather than a missing resource.- Parameters:
client (flask.testing.FlaskClient) – The test client provided by
client().
- tests.test_rooms.test_valid_room_returns_200(client, test_room, logged_in_owner)¶
Call endpoint redirects the owner when they are not yet in the Socket.IO room.
Issues a
GET /call?room=TEST-1234as the authenticated room owner and asserts a302redirect. Even though the owner is exempt from the guest host-presence check, the in-memoryroomsdictionary is empty in the test environment (no Socket.IO connection has been made), so the view still redirects rather than rendering the call page. A200would only be returned once the owner’s SID is registered via a realjoin_roomWebSocket event.- Parameters:
client (flask.testing.FlaskClient) – The test client provided by
client().test_room (app.models.Room) – The seeded room with code
'TEST-1234', provided bytest_room().logged_in_owner (app.models.User) – The authenticated room owner, provided by
logged_in_owner().