'Test that the server runs with `DEBUG=True`.'

@mock.patch(u'channels.management.commands.runserver.sys.stdout', new_callable=StringIO)
@mock.patch(u'channels.management.commands.runserver.Command.server_cls')
@mock.patch(u'channels.management.commands.runworker.Worker')
def test_runserver_debug(self, mocked_worker, mocked_server, mock_stdout):

    with self.settings(DEBUG=True, STATIC_URL=u'/static/'):
        call_command(u'runserver', u'--noreload')
        mocked_server.assert_called_with(endpoints=[u'tcp:port=8000:interface=127.0.0.1'], signal_handlers=True, http_timeout=60, action_logger=mock.ANY, channel_layer=mock.ANY, ws_protocols=None, root_path=u'', websocket_handshake_timeout=5)
        call_command(u'runserver', u'--noreload', u'localhost:8001')
        mocked_server.assert_called_with(endpoints=[u'tcp:port=8001:interface=localhost'], signal_handlers=True, http_timeout=60, action_logger=mock.ANY, channel_layer=mock.ANY, ws_protocols=None, root_path=u'', websocket_handshake_timeout=5)
    self.assertFalse(mocked_worker.called, u"The    worker    should    not    be    called    with    '--noworker'")
