Add required test suite and websocket fixes
This commit is contained in:
@@ -1,2 +1,22 @@
|
||||
def test_placeholder_reconnect():
|
||||
assert True
|
||||
from conftest import create_session, join_student
|
||||
|
||||
|
||||
def test_reconnect_replays_existing_submit_ack(client, sample_pool):
|
||||
sid = create_session(client, sample_pool)
|
||||
join_student(client, sid, "s1", "Student One")
|
||||
rooms = client.app.state.rooms
|
||||
client.portal.call(rooms.open_question, sid, 0, 2)
|
||||
|
||||
with client.websocket_connect(f"/ws/student/{sid}") as ws:
|
||||
assert ws.receive_json()["type"] == "state"
|
||||
assert ws.receive_json()["type"] == "question_open"
|
||||
ws.send_json({"type": "submit", "question_idx": 0, "answer": "B"})
|
||||
ack = ws.receive_json()
|
||||
assert ack["type"] == "submit_ack"
|
||||
|
||||
with client.websocket_connect(f"/ws/student/{sid}") as ws:
|
||||
assert ws.receive_json()["type"] == "state"
|
||||
assert ws.receive_json()["type"] == "question_open"
|
||||
replay = ws.receive_json()
|
||||
assert replay["type"] == "submit_ack"
|
||||
assert replay["score"] == ack["score"]
|
||||
|
||||
Reference in New Issue
Block a user