summaryrefslogtreecommitdiff
path: root/tests/admin_scripts/tests.py
diff options
context:
space:
mode:
authorAndrew Miller <info@akmiller.co.uk>2024-08-07 16:25:07 +0100
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2024-08-09 10:34:10 +0200
commit69aa13ffb92f6a7c62661c616a8c7b0f515ea43d (patch)
treed6b2359e39b3fc93252f944b8a4745fc4ff2c8e9 /tests/admin_scripts/tests.py
parent95827452571eb976c4f0d5e9ac46843948dd5fe6 (diff)
Fixed #35591 -- Added unsuitable for production console warning to runserver.
Diffstat (limited to 'tests/admin_scripts/tests.py')
-rw-r--r--tests/admin_scripts/tests.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/admin_scripts/tests.py b/tests/admin_scripts/tests.py
index 2e77f2c97a..67362460a9 100644
--- a/tests/admin_scripts/tests.py
+++ b/tests/admin_scripts/tests.py
@@ -1597,6 +1597,13 @@ class ManageRunserver(SimpleTestCase):
"Starting development server at http://0.0.0.0:8000/",
self.output.getvalue(),
)
+ self.assertIn(
+ "WARNING: This is a development server. Do not use it in a "
+ "production setting. Use a production WSGI or ASGI server instead."
+ "\nFor more information on production servers see: "
+ "https://docs.djangoproject.com/en/stable/howto/deployment/",
+ self.output.getvalue(),
+ )
def test_on_bind(self):
self.cmd.addr = "127.0.0.1"
@@ -1606,6 +1613,30 @@ class ManageRunserver(SimpleTestCase):
"Starting development server at http://127.0.0.1:14437/",
self.output.getvalue(),
)
+ self.assertIn(
+ "WARNING: This is a development server. Do not use it in a "
+ "production setting. Use a production WSGI or ASGI server instead."
+ "\nFor more information on production servers see: "
+ "https://docs.djangoproject.com/en/stable/howto/deployment/",
+ self.output.getvalue(),
+ )
+
+ @mock.patch.dict(os.environ, {"HIDE_PRODUCTION_WARNING": "true"})
+ def test_hide_production_warning_with_environment_variable(self):
+ self.cmd.addr = "0"
+ self.cmd._raw_ipv6 = False
+ self.cmd.on_bind("8000")
+ self.assertIn(
+ "Starting development server at http://0.0.0.0:8000/",
+ self.output.getvalue(),
+ )
+ self.assertNotIn(
+ "WARNING: This is a development server. Do not use it in a "
+ "production setting. Use a production WSGI or ASGI server instead."
+ "\nFor more information on production servers see: "
+ "https://docs.djangoproject.com/en/stable/howto/deployment/",
+ self.output.getvalue(),
+ )
@unittest.skipUnless(socket.has_ipv6, "platform doesn't support IPv6")
def test_runner_addrport_ipv6(self):