mirror of https://gitlab.com/litecord/litecord.git
Add test to ensure a removed state invalidates WS
This commit is contained in:
parent
7b6b696717
commit
323013cb87
|
|
@ -205,9 +205,7 @@ async def test_resume(test_cli_user):
|
|||
|
||||
# try to resume
|
||||
conn = await gw_start(test_cli_user.cli)
|
||||
|
||||
# get the hello frame but ignore it
|
||||
await _json(conn)
|
||||
_ = await _json(conn)
|
||||
|
||||
await _json_send(
|
||||
conn,
|
||||
|
|
@ -227,3 +225,30 @@ async def test_resume(test_cli_user):
|
|||
assert msg["op"] == OP.DISPATCH
|
||||
assert isinstance(msg["t"], str)
|
||||
assert msg["t"] in ("RESUMED", "PRESENCE_REPLACE")
|
||||
|
||||
# close again, and retry again, but this time by removing the state
|
||||
# and asserting the session won't be resumed.
|
||||
await _close(conn)
|
||||
|
||||
conn = await gw_start(test_cli_user.cli)
|
||||
_ = await _json(conn)
|
||||
|
||||
async with test_cli_user.app.app_context():
|
||||
test_cli_user.app.state_manager.remove(sess_id)
|
||||
|
||||
await _json_send(
|
||||
conn,
|
||||
{
|
||||
"op": OP.RESUME,
|
||||
"d": {
|
||||
"token": test_cli_user.user["token"],
|
||||
"session_id": sess_id,
|
||||
"seq": 0,
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
msg = await _json(conn)
|
||||
assert isinstance(msg, dict)
|
||||
assert isinstance(msg["op"], int)
|
||||
assert msg["op"] == OP.INVALID_SESSION
|
||||
|
|
|
|||
Loading…
Reference in New Issue