From 8f6edd5486ff9e33aa7dbce7f5a802e012c2b78e Mon Sep 17 00:00:00 2001 From: Lennart Grahl Date: Thu, 24 Jan 2019 13:03:40 +0100 Subject: [PATCH] Add test for discarding string messages --- tests/test_protocol.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/test_protocol.py b/tests/test_protocol.py index 1734505..657f464 100644 --- a/tests/test_protocol.py +++ b/tests/test_protocol.py @@ -83,6 +83,17 @@ async def test_invalid_path_symbols(self, url_factory, server, ws_client_factory assert client.close_code == CloseCode.protocol_error assert len(server.protocols) == 0 + @pytest.mark.asyncio + async def test_invalid_message_str(self, server, ws_client_factory): + """ + The server must discard string messages. + """ + client = await ws_client_factory() + await client.send('m30w' * 10) + await server.wait_connections_closed() + assert not client.open + assert client.close_code == CloseCode.protocol_error + @pytest.mark.asyncio async def test_server_hello(self, server, client_factory): """