File tree Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -287,6 +287,7 @@ def test_versioned_no_slash(self):
287
287
response ['location' ], '/en/latest/' ,
288
288
)
289
289
290
+
290
291
@mock .patch ('readthedocs.proxito.views.serve.get_storage_class' )
291
292
def test_directory_indexes_readme_serving (self , storage_mock ):
292
293
self .project .versions .update (active = True , built = True )
Original file line number Diff line number Diff line change 12
12
)
13
13
class RedirectTests (BaseDocServing ):
14
14
15
+ def test_root_url_no_slash (self ):
16
+ r = self .client .get ('' , HTTP_HOST = 'project.dev.readthedocs.io' )
17
+ self .assertEqual (r .status_code , 302 )
18
+ self .assertEqual (
19
+ r ['Location' ], 'https://project.dev.readthedocs.io/en/latest/' ,
20
+ )
21
+
15
22
def test_root_url (self ):
16
23
r = self .client .get ('/' , HTTP_HOST = 'project.dev.readthedocs.io' )
17
24
self .assertEqual (r .status_code , 302 )
@@ -26,6 +33,13 @@ def test_subproject_root_url(self):
26
33
r ['Location' ], 'https://project.dev.readthedocs.io/projects/subproject/en/latest/' ,
27
34
)
28
35
36
+ def test_subproject_root_url_no_slash (self ):
37
+ r = self .client .get ('/projects/subproject' , HTTP_HOST = 'project.dev.readthedocs.io' )
38
+ self .assertEqual (r .status_code , 302 )
39
+ self .assertEqual (
40
+ r ['Location' ], 'https://project.dev.readthedocs.io/projects/subproject/en/latest/' ,
41
+ )
42
+
29
43
def test_root_redirect_with_query_params (self ):
30
44
r = self .client .get ('/?foo=bar' , HTTP_HOST = 'project.dev.readthedocs.io' )
31
45
self .assertEqual (r .status_code , 302 )
Original file line number Diff line number Diff line change 147
147
# (Sub)project single version
148
148
url (
149
149
(
150
- r'^(?:projects/(?P<subproject_slug>{project_slug})/)?'
150
+ r'^(?:projects/(?P<subproject_slug>{project_slug})/? )?'
151
151
r'(?P<filename>{filename_slug})$' .format (** pattern_opts )
152
152
),
153
153
ServeDocs .as_view (),
You can’t perform that action at this time.
0 commit comments