import unittest from kaya.rsgi import RsgiWebSocket class RsgiWebSocketTest(unittest.TestCase): def test_misconfigured_granian(self): class FakeScope: scheme = 'ws' path = '/ws' query_string = '' headers = {} client = '127.0.0.1:12345' server = '127.0.0.1:80' class FakeProtocol: pass with self.assertRaises(RuntimeError) as ctx: RsgiWebSocket(FakeScope(), FakeProtocol()) # type: ignore[arg-type] self.assertIn('Granian was not configured for websockets', str(ctx.exception))