mirror of https://github.com/django/django.git
Fixed #28941 -- Fixed crash in testserver command startup.
Regression in 2b09e4c88e
.
This commit is contained in:
parent
c8a85e3e91
commit
e7b804c060
|
@ -27,6 +27,7 @@ class Command(BaseCommand):
|
|||
# Validation is called explicitly each time the server is reloaded.
|
||||
requires_system_checks = False
|
||||
leave_locale_alone = True
|
||||
stealth_options = ('shutdown_message',)
|
||||
|
||||
default_addr = '127.0.0.1'
|
||||
default_addr_ipv6 = '::1'
|
||||
|
|
|
@ -29,3 +29,5 @@ Bugfixes
|
|||
|
||||
* Fixed a regression on SQLite where ``DecimalField`` returned a result with
|
||||
trailing zeros in the fractional part truncated (:ticket:`28915`).
|
||||
|
||||
* Fixed crash in the ``testserver`` command startup (:ticket:`28941`).
|
||||
|
|
|
@ -21,7 +21,9 @@ from django.conf import settings
|
|||
from django.core.management import (
|
||||
BaseCommand, CommandError, call_command, color,
|
||||
)
|
||||
from django.db import ConnectionHandler
|
||||
from django.core.management.commands.loaddata import Command as LoaddataCommand
|
||||
from django.core.management.commands.runserver import Command as RunserverCommand
|
||||
from django.db import ConnectionHandler, connection
|
||||
from django.db.migrations.recorder import MigrationRecorder
|
||||
from django.test import (
|
||||
LiveServerTestCase, SimpleTestCase, TestCase, override_settings,
|
||||
|
@ -1416,6 +1418,31 @@ class ManageTestserver(AdminScriptTestCase):
|
|||
skip_checks=True, interactive=True,
|
||||
)
|
||||
|
||||
@mock.patch('django.db.connection.creation.create_test_db', return_value='test_db')
|
||||
@mock.patch.object(LoaddataCommand, 'handle', return_value='')
|
||||
@mock.patch.object(RunserverCommand, 'handle', return_value='')
|
||||
def test_params_to_runserver(self, mock_runserver_handle, mock_loaddata_handle, mock_create_test_db):
|
||||
out = StringIO()
|
||||
call_command('testserver', 'blah.json', stdout=out)
|
||||
mock_runserver_handle.assert_called_with(
|
||||
addrport='',
|
||||
insecure_serving=False,
|
||||
no_color=False,
|
||||
pythonpath=None,
|
||||
settings=None,
|
||||
shutdown_message=(
|
||||
"\nServer stopped.\nNote that the test database, 'test_db', "
|
||||
"has not been deleted. You can explore it on your own."
|
||||
),
|
||||
skip_checks=True,
|
||||
traceback=False,
|
||||
use_ipv6=False,
|
||||
use_reloader=False,
|
||||
use_static_handler=True,
|
||||
use_threading=connection.features.test_db_allows_multiple_connections,
|
||||
verbosity=1,
|
||||
)
|
||||
|
||||
|
||||
##########################################################################
|
||||
# COMMAND PROCESSING TESTS
|
||||
|
|
Loading…
Reference in New Issue