1
1
# Copied from .org test_redirects
2
2
3
3
4
+ from django .test import override_settings
5
+
4
6
from .base import BaseDocServing
5
7
6
8
9
+ @override_settings (PUBLIC_DOMAIN_USES_HTTPS = True )
7
10
class RedirectTests (BaseDocServing ):
8
11
9
12
def test_root_url (self ):
10
13
r = self .client .get ('/' , HTTP_HOST = 'project.dev.readthedocs.io' )
11
14
self .assertEqual (r .status_code , 302 )
12
15
self .assertEqual (
13
- r ['Location' ], 'http ://project.dev.readthedocs.io/en/latest/' ,
16
+ r ['Location' ], 'https ://project.dev.readthedocs.io/en/latest/' ,
14
17
)
15
18
16
19
def test_subproject_root_url (self ):
17
20
r = self .client .get ('/projects/subproject/' , HTTP_HOST = 'project.dev.readthedocs.io' )
18
21
self .assertEqual (r .status_code , 302 )
19
22
self .assertEqual (
20
- r ['Location' ], 'http ://project.dev.readthedocs.io/projects/subproject/en/latest/' ,
23
+ r ['Location' ], 'https ://project.dev.readthedocs.io/projects/subproject/en/latest/' ,
21
24
)
22
25
23
26
def test_root_redirect_with_query_params (self ):
24
27
r = self .client .get ('/?foo=bar' , HTTP_HOST = 'project.dev.readthedocs.io' )
25
28
self .assertEqual (r .status_code , 302 )
26
29
self .assertEqual (
27
30
r ['Location' ],
28
- 'http ://project.dev.readthedocs.io/en/latest/?foo=bar'
31
+ 'https ://project.dev.readthedocs.io/en/latest/?foo=bar'
29
32
)
30
33
31
34
# Specific Page Redirects
@@ -34,5 +37,5 @@ def test_proper_page_on_subdomain(self):
34
37
self .assertEqual (r .status_code , 302 )
35
38
self .assertEqual (
36
39
r ['Location' ],
37
- 'http ://project.dev.readthedocs.io/en/latest/test.html' ,
40
+ 'https ://project.dev.readthedocs.io/en/latest/test.html' ,
38
41
)
0 commit comments