mirror of
https://github.com/django/daphne.git
synced 2025-04-20 08:42:18 +03:00
pass subprotocols if defined (#282)
This commit is contained in:
parent
a37238a769
commit
9bd8bcf652
|
@ -80,6 +80,7 @@ class Command(RunserverCommand):
|
|||
signal_handlers=not options['use_reloader'],
|
||||
action_logger=self.log_action,
|
||||
http_timeout=60, # Shorter timeout than normal as it's dev
|
||||
ws_protocols=getattr(settings, 'CHANNELS_WS_PROTOCOLS', None),
|
||||
).run()
|
||||
self.logger.debug("Daphne exited")
|
||||
except KeyboardInterrupt:
|
||||
|
|
|
@ -86,7 +86,8 @@ class RunServerTests(TestCase):
|
|||
# https://github.com/django/django/blob/master/django/core/management/commands/runserver.py#L105
|
||||
call_command('runserver', '--noreload')
|
||||
mocked_server.assert_called_with(port=8000, signal_handlers=True, http_timeout=60,
|
||||
host='127.0.0.1', action_logger=mock.ANY, channel_layer=mock.ANY)
|
||||
host='127.0.0.1', action_logger=mock.ANY, channel_layer=mock.ANY,
|
||||
ws_protocols=None)
|
||||
|
||||
@mock.patch('channels.management.commands.runserver.sys.stdout', new_callable=StringIO)
|
||||
@mock.patch('channels.management.commands.runserver.Server')
|
||||
|
@ -99,11 +100,13 @@ class RunServerTests(TestCase):
|
|||
with self.settings(DEBUG=True, STATIC_URL='/static/'):
|
||||
call_command('runserver', '--noreload')
|
||||
mocked_server.assert_called_with(port=8000, signal_handlers=True, http_timeout=60,
|
||||
host='127.0.0.1', action_logger=mock.ANY, channel_layer=mock.ANY)
|
||||
host='127.0.0.1', action_logger=mock.ANY, channel_layer=mock.ANY,
|
||||
ws_protocols=None)
|
||||
|
||||
call_command('runserver', '--noreload', 'localhost:8001')
|
||||
mocked_server.assert_called_with(port=8001, signal_handlers=True, http_timeout=60,
|
||||
host='localhost', action_logger=mock.ANY, channel_layer=mock.ANY)
|
||||
host='localhost', action_logger=mock.ANY, channel_layer=mock.ANY,
|
||||
ws_protocols=None)
|
||||
|
||||
self.assertFalse(mocked_worker.called,
|
||||
"The worker should not be called with '--noworker'")
|
||||
|
@ -117,7 +120,8 @@ class RunServerTests(TestCase):
|
|||
'''
|
||||
call_command('runserver', '--noreload', '--noworker')
|
||||
mocked_server.assert_called_with(port=8000, signal_handlers=True, http_timeout=60,
|
||||
host='127.0.0.1', action_logger=mock.ANY, channel_layer=mock.ANY)
|
||||
host='127.0.0.1', action_logger=mock.ANY, channel_layer=mock.ANY,
|
||||
ws_protocols=None)
|
||||
self.assertFalse(mocked_worker.called,
|
||||
"The worker should not be called with '--noworker'")
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user