|
14 | 14 | from django.http import Http404
|
15 | 15 | from django.test.utils import override_settings
|
16 | 16 | from django.urls import Resolver404
|
| 17 | +from django_dynamic_fixture import get |
17 | 18 |
|
18 | 19 | from readthedocs.builds.models import Version
|
19 | 20 | from readthedocs.projects.models import Feature
|
@@ -153,6 +154,18 @@ def test_root_redirect_with_query_params(self):
|
153 | 154 | )
|
154 | 155 |
|
155 | 156 |
|
| 157 | +class ProxitoV2InternalRedirectTests(InternalRedirectTests): |
| 158 | + # TODO: remove this class once the new implementation is the default. |
| 159 | + def setUp(self): |
| 160 | + super().setUp() |
| 161 | + get( |
| 162 | + Feature, |
| 163 | + feature_id=Feature.USE_UNRESOLVER_WITH_PROXITO, |
| 164 | + default_true=True, |
| 165 | + future_default_true=True, |
| 166 | + ) |
| 167 | + |
| 168 | + |
156 | 169 | # Use ``PYTHON_MEDIA`` here to raise a 404 when trying to serve the file
|
157 | 170 | # from disk and execute the code for the handler404 (the file does not
|
158 | 171 | # exist). On production, this will happen when trying to serve from
|
@@ -649,6 +662,18 @@ def test_not_found_page_without_trailing_slash(self):
|
649 | 662 | )
|
650 | 663 |
|
651 | 664 |
|
| 665 | +class ProxitoV2UserRedirectTests(UserRedirectTests): |
| 666 | + # TODO: remove this class once the new implementation is the default. |
| 667 | + def setUp(self): |
| 668 | + super().setUp() |
| 669 | + get( |
| 670 | + Feature, |
| 671 | + feature_id=Feature.USE_UNRESOLVER_WITH_PROXITO, |
| 672 | + default_true=True, |
| 673 | + future_default_true=True, |
| 674 | + ) |
| 675 | + |
| 676 | + |
652 | 677 | @override_settings(PUBLIC_DOMAIN="dev.readthedocs.io")
|
653 | 678 | class UserForcedRedirectTests(BaseDocServing):
|
654 | 679 | def test_no_forced_redirect(self):
|
@@ -943,6 +968,19 @@ def test_redirect_with_301_status(self):
|
943 | 968 | "http://project.dev.readthedocs.io/en/latest/tutorial/install.html",
|
944 | 969 | )
|
945 | 970 |
|
| 971 | + |
| 972 | +class ProxitoV2UserForcedRedirectTests(UserForcedRedirectTests): |
| 973 | + # TODO: remove this class once the new implementation is the default. |
| 974 | + def setUp(self): |
| 975 | + super().setUp() |
| 976 | + get( |
| 977 | + Feature, |
| 978 | + feature_id=Feature.USE_UNRESOLVER_WITH_PROXITO, |
| 979 | + default_true=True, |
| 980 | + future_default_true=True, |
| 981 | + ) |
| 982 | + |
| 983 | + |
946 | 984 | @override_settings(
|
947 | 985 | PYTHON_MEDIA=True,
|
948 | 986 | PUBLIC_DOMAIN="dev.readthedocs.io",
|
@@ -1085,3 +1123,15 @@ def test_redirect_sphinx_html_crossdomain(self):
|
1085 | 1123 | )
|
1086 | 1124 | self.assertEqual(r.status_code, 302, url)
|
1087 | 1125 | self.assertEqual(r["Location"], expected_location, url)
|
| 1126 | + |
| 1127 | + |
| 1128 | +class ProxitoV2UserRedirectCrossdomainTest(UserRedirectCrossdomainTest): |
| 1129 | + # TODO: remove this class once the new implementation is the default. |
| 1130 | + def setUp(self): |
| 1131 | + super().setUp() |
| 1132 | + get( |
| 1133 | + Feature, |
| 1134 | + feature_id=Feature.USE_UNRESOLVER_WITH_PROXITO, |
| 1135 | + default_true=True, |
| 1136 | + future_default_true=True, |
| 1137 | + ) |
0 commit comments