From 30688f638c7f66a1ebffa160ac734ad62f30518a Mon Sep 17 00:00:00 2001 From: meejah Date: Wed, 14 Apr 2021 17:07:50 -0600 Subject: [PATCH] test to ensure we make a websocket service when passing --websocket --- src/wormhole_transit_relay/test/test_service.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/wormhole_transit_relay/test/test_service.py b/src/wormhole_transit_relay/test/test_service.py index f84b01a..3205bb7 100644 --- a/src/wormhole_transit_relay/test/test_service.py +++ b/src/wormhole_transit_relay/test/test_service.py @@ -5,6 +5,7 @@ try: except ImportError: import mock from twisted.application.service import MultiService +from autobahn.twisted.websocket import WebSocketServerFactory from .. import server_tap class Service(unittest.TestCase): @@ -40,3 +41,13 @@ class Service(unittest.TestCase): [mock.call(blur_usage=None, log_file=fd, usage_db=None)]) + def test_websocket(self): + o = server_tap.Options() + o.parseOptions(["--websocket=tcp:4004"]) + services = server_tap.makeService(o) + self.assertTrue( + any( + isinstance(s.factory, WebSocketServerFactory) + for s in services.services + ) + )