mirror of
https://github.com/django/daphne.git
synced 2025-04-20 08:42:18 +03:00
Fix root_path in runserver tests
This commit is contained in:
parent
5a38171fc7
commit
3d2426e7b4
|
@ -85,9 +85,16 @@ class RunServerTests(TestCase):
|
|||
# See:
|
||||
# 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,
|
||||
ws_protocols=None, root_path=None)
|
||||
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,
|
||||
ws_protocols=None,
|
||||
root_path='',
|
||||
)
|
||||
|
||||
@mock.patch('channels.management.commands.runserver.sys.stdout', new_callable=StringIO)
|
||||
@mock.patch('channels.management.commands.runserver.Server')
|
||||
|
@ -99,17 +106,33 @@ class RunServerTests(TestCase):
|
|||
# Debug requires the static url is set.
|
||||
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,
|
||||
ws_protocols=None, root_path=None)
|
||||
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,
|
||||
ws_protocols=None,
|
||||
root_path='',
|
||||
)
|
||||
|
||||
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,
|
||||
ws_protocols=None, root_path=None)
|
||||
mocked_server.assert_called_with(
|
||||
port=8001,
|
||||
signal_handlers=True,
|
||||
http_timeout=60,
|
||||
host='localhost',
|
||||
action_logger=mock.ANY,
|
||||
channel_layer=mock.ANY,
|
||||
ws_protocols=None,
|
||||
root_path='',
|
||||
)
|
||||
|
||||
self.assertFalse(mocked_worker.called,
|
||||
"The worker should not be called with '--noworker'")
|
||||
self.assertFalse(
|
||||
mocked_worker.called,
|
||||
"The worker should not be called with '--noworker'",
|
||||
)
|
||||
|
||||
@mock.patch('channels.management.commands.runserver.sys.stdout', new_callable=StringIO)
|
||||
@mock.patch('channels.management.commands.runserver.Server')
|
||||
|
@ -119,11 +142,20 @@ class RunServerTests(TestCase):
|
|||
Test that the Worker is not called when using the `--noworker` parameter.
|
||||
'''
|
||||
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,
|
||||
ws_protocols=None, root_path=None)
|
||||
self.assertFalse(mocked_worker.called,
|
||||
"The worker should not be called with '--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,
|
||||
ws_protocols=None,
|
||||
root_path='',
|
||||
)
|
||||
self.assertFalse(
|
||||
mocked_worker.called,
|
||||
"The worker should not be called with '--noworker'",
|
||||
)
|
||||
|
||||
@mock.patch('channels.management.commands.runserver.sys.stderr', new_callable=StringIO)
|
||||
def test_log_action(self, mocked_stderr):
|
||||
|
|
Loading…
Reference in New Issue
Block a user