MCPcopy
hub / github.com/django/django / test_not_prefixed

Method test_not_prefixed

tests/settings_tests/tests.py:610–629  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

608 set_script_prefix(val)
609
610 def test_not_prefixed(self):
611 # Don't add SCRIPT_NAME prefix to absolute paths, URLs, or None.
612 tests = (
613 "/path/",
614 "http://myhost.com/path/",
615 "http://myhost/path/",
616 "https://myhost/path/",
617 None,
618 )
619 for setting in ("MEDIA_URL", "STATIC_URL"):
620 for path in tests:
621 new_settings = {setting: path}
622 with self.settings(**new_settings):
623 for script_name in ["/somesubpath", "/somesubpath/", "/", "", None]:
624 with self.subTest(script_name=script_name, **new_settings):
625 try:
626 self.set_script_name(script_name)
627 self.assertEqual(getattr(settings, setting), path)
628 finally:
629 clear_script_prefix()
630
631 def test_add_script_name_prefix(self):
632 tests = (

Callers

nothing calls this directly

Calls 3

set_script_nameMethod · 0.95
clear_script_prefixFunction · 0.90
settingsMethod · 0.45

Tested by

no test coverage detected