test to ensure we make a websocket service when passing --websocket

This commit is contained in:
meejah 2021-04-14 17:07:50 -06:00
parent 425f040168
commit 30688f638c

View File

@ -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
)
)