diff --git a/readthedocs/proxito/tests/test_middleware.py b/readthedocs/proxito/tests/test_middleware.py index 59c9801591d..619598852d8 100644 --- a/readthedocs/proxito/tests/test_middleware.py +++ b/readthedocs/proxito/tests/test_middleware.py @@ -123,24 +123,6 @@ def test_subproject_redirect(self): resp["X-RTD-Redirect"], RedirectType.subproject_to_main_domain.name ) - # We are not canonicalizing custom domains -> public domain for now - @pytest.mark.xfail(strict=True) - def test_canonical_cname_redirect_public_domain(self): - """Requests to a custom domain should redirect to the public domain or canonical domain if not canonical.""" - cname = 'docs.random.com' - domain = get(Domain, project=self.pip, domain=cname, canonical=False, https=False) - - resp = self.client.get(self.url, HTTP_HOST=cname) - self.assertEqual(resp.status_code, 302) - self.assertEqual(resp["X-RTD-Redirect"], "noncanonical-cname") - - # Make the domain canonical and make sure we don't redirect - domain.canonical = True - domain.save() - for url in (self.url, '/subdir/'): - resp = self.client.get(url, HTTP_HOST=cname) - self.assertNotIn("X-RTD-Redirect", resp) - def test_proper_cname_uppercase(self): get(Domain, project=self.pip, domain='docs.random.com') request = self.request(method='get', path=self.url, HTTP_HOST='docs.RANDOM.COM') diff --git a/readthedocs/proxito/tests/test_redirects.py b/readthedocs/proxito/tests/test_redirects.py index 1a1c5c5236d..ce7984199d4 100644 --- a/readthedocs/proxito/tests/test_redirects.py +++ b/readthedocs/proxito/tests/test_redirects.py @@ -1,6 +1,5 @@ # Copied from .org test_redirects -import pytest from django.test import override_settings from readthedocs.proxito.constants import RedirectType @@ -203,25 +202,6 @@ def test_translation_secure_redirect(self): ) self.assertEqual(r["X-RTD-Redirect"], RedirectType.system.name) - # We are not canonicalizing custom domains -> public domain for now - @pytest.mark.xfail(strict=True) - def test_canonicalize_cname_to_public_domain_redirect(self): - """Redirect to the public domain if the CNAME is not canonical.""" - r = self.client.get('/', HTTP_HOST=self.domain.domain) - self.assertEqual(r.status_code, 302) - self.assertEqual( - r['Location'], 'https://project.dev.readthedocs.io/en/latest/', - ) - self.assertEqual(r['X-RTD-Redirect'], 'noncanonical-cname') - - # We should redirect before 404ing - r = self.client.get('/en/latest/404after302', HTTP_HOST=self.domain2.domain) - self.assertEqual(r.status_code, 302) - self.assertEqual( - r['Location'], 'https://project.dev.readthedocs.io/en/latest/404after302', - ) - self.assertEqual(r['X-RTD-Redirect'], 'noncanonical-cname') - # Specific Page Redirects def test_proper_page_on_subdomain(self): r = self.client.get('/page/test.html', HTTP_HOST='project.dev.readthedocs.io')