Skip to content

Test external serving for projects with -- in slug #8716

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 29, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion readthedocs/proxito/tests/test_full.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,34 @@ def test_external_version_serving(self):
resp['x-accel-redirect'], '/proxito/media/external/html/project/10/awesome.html',
)

# Invalid tests
@override_settings(
RTD_EXTERNAL_VERSION_DOMAIN='dev.readthedocs.build',
)
def test_external_version_serving_old_slugs(self):
"""
Test external version serving with projects with `--` in their slug.

Some old projects may have been created with a slug containg `--`,
our current code doesn't allow these type of slugs.
"""
fixture.get(
Version,
verbose_name='10',
slug='10',
type=EXTERNAL,
active=True,
project=self.project,
)
self.project.slug = 'test--project'
self.project.save()

host = 'test--project--10.dev.readthedocs.build'
resp = self.client.get('/awesome.html', HTTP_HOST=host)
self.assertEqual(
resp['x-accel-redirect'], '/proxito/media/external/html/test--project/10/awesome.html',
)

# Invalid tests

@override_settings(
RTD_EXTERNAL_VERSION_DOMAIN='dev.readthedocs.build',
Expand Down