Skip to content

Commit

Permalink
Remove unused tests (#10099)
Browse files Browse the repository at this point in the history
  • Loading branch information
stsewd authored Mar 2, 2023
1 parent 12be8a7 commit cd8f2da
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 38 deletions.
18 changes: 0 additions & 18 deletions readthedocs/proxito/tests/test_middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
20 changes: 0 additions & 20 deletions readthedocs/proxito/tests/test_redirects.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Copied from .org test_redirects

import pytest
from django.test import override_settings

from readthedocs.proxito.constants import RedirectType
Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit cd8f2da

Please sign in to comment.