Skip to content

Commit f41dad2

Browse files
authored
Test external serving for projects with -- in slug (#8716)
1 parent 62caf48 commit f41dad2

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

readthedocs/proxito/tests/test_full.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,34 @@ def test_external_version_serving(self):
170170
resp['x-accel-redirect'], '/proxito/media/external/html/project/10/awesome.html',
171171
)
172172

173-
# Invalid tests
173+
@override_settings(
174+
RTD_EXTERNAL_VERSION_DOMAIN='dev.readthedocs.build',
175+
)
176+
def test_external_version_serving_old_slugs(self):
177+
"""
178+
Test external version serving with projects with `--` in their slug.
179+
180+
Some old projects may have been created with a slug containg `--`,
181+
our current code doesn't allow these type of slugs.
182+
"""
183+
fixture.get(
184+
Version,
185+
verbose_name='10',
186+
slug='10',
187+
type=EXTERNAL,
188+
active=True,
189+
project=self.project,
190+
)
191+
self.project.slug = 'test--project'
192+
self.project.save()
193+
194+
host = 'test--project--10.dev.readthedocs.build'
195+
resp = self.client.get('/awesome.html', HTTP_HOST=host)
196+
self.assertEqual(
197+
resp['x-accel-redirect'], '/proxito/media/external/html/test--project/10/awesome.html',
198+
)
199+
200+
# Invalid tests
174201

175202
@override_settings(
176203
RTD_EXTERNAL_VERSION_DOMAIN='dev.readthedocs.build',

0 commit comments

Comments
 (0)