tests: assert we are in a good state on autoreply

This commit is contained in:
Luna 2022-01-28 23:38:12 -03:00
parent 38b560205f
commit 049523b03f
1 changed files with 2 additions and 0 deletions

View File

@ -28,6 +28,7 @@ import pytest
import websockets import websockets
from logbook import Logger from logbook import Logger
from wsproto import WSConnection, ConnectionType from wsproto import WSConnection, ConnectionType
from wsproto.connection import ConnectionState
from wsproto.events import ( from wsproto.events import (
Request, Request,
Message, Message,
@ -132,6 +133,7 @@ class AsyncWebsocket:
break break
if isinstance(event, CloseConnection): if isinstance(event, CloseConnection):
assert self.ws.state is ConnectionState.REMOTE_CLOSING
await self.send(event.response()) await self.send(event.response())
if process_event: if process_event:
raise websockets.ConnectionClosed( raise websockets.ConnectionClosed(