(self)
| 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 = ( |
nothing calls this directly
no test coverage detected