summaryrefslogtreecommitdiff
path: root/tests/admin_scripts
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2017-12-20 13:08:45 -0500
committerTim Graham <timograham@gmail.com>2017-12-20 14:38:06 -0500
commite7b804c060a1f9fc089cf935801aa85b09db062b (patch)
treed6cb8bff6cf0881048215c0d8d5b23773fdd8893 /tests/admin_scripts
parentc8a85e3e91bf829671b4a8cbd105fbabce945174 (diff)
downloaddjango-e7b804c060a1f9fc089cf935801aa85b09db062b.tar.gz
Fixed #28941 -- Fixed crash in testserver command startup.
Regression in 2b09e4c88e96cb03b29f5a6b0e4838ab4271e631.
Diffstat (limited to 'tests/admin_scripts')
-rw-r--r--tests/admin_scripts/tests.py29
1 files changed, 28 insertions, 1 deletions
diff --git a/tests/admin_scripts/tests.py b/tests/admin_scripts/tests.py
index 1670af86fb..3ee417b6d0 100644
--- a/tests/admin_scripts/tests.py
+++ b/tests/admin_scripts/tests.py
@@ -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