1
- # -*- coding: utf-8 -*-
2
1
import mock
3
2
import pytest
4
3
from django .conf import settings
@@ -21,16 +20,15 @@ def setUp(self):
21
20
)
22
21
23
22
self .pip_latest_url = url_base .format (version = '/en/latest/' )
23
+ self .pip_latest_url_index = url_base .format (version = '/en/latest/index.html' )
24
24
self .pip_latest_fr_url = url_base .format (version = '/fr/latest/' )
25
25
self .pip_abc_url = url_base .format (version = '/en/abc/' )
26
+ self .pip_abc_url_index = url_base .format (version = '/en/abc/index.html' )
26
27
self .pip_abc_fr_url = url_base .format (version = '/fr/abc/' )
27
- self .pip_abc_xyz_page_url = url_base .format (version = '/en/abc/xyz.html' )
28
- self .pip_abc_xyz_fr_page_url = url_base .format (version = '/fr/abc/xyz.html' )
29
- self .pip_abc_xyz_dir_url = url_base .format (version = '/en/abc/xyz/' )
30
- self .pip_abc_xyz_fr_dir_url = url_base .format (version = '/fr/abc/xyz/' )
31
- self .pip_abc_xyz_document = url_base .format (version = '/en/abc/index.html#document-xyz' )
32
- self .pip_abc_xyz_fr_document = url_base .format (version = '/fr/abc/index.html#document-xyz' )
33
- self .pip_latest_document_url = url_base .format (version = '/en/latest/document/' )
28
+ self .pip_abc_fr_url_index = url_base .format (version = '/fr/abc/index.html' )
29
+ self .pip_abc_xyz_page_url = url_base .format (version = '/en/abc/xyz' )
30
+ self .pip_abc_xyz_fr_page_url = url_base .format (version = '/fr/abc/xyz' )
31
+ self .pip_latest_document_url = url_base .format (version = '/en/latest/document' )
34
32
self .pip_latest_document_page_url = url_base .format (version = '/en/latest/document.html' )
35
33
36
34
with mock .patch ('readthedocs.projects.models.broadcast' ):
@@ -45,136 +43,40 @@ def test_project_only(self):
45
43
url = core_tags .make_document_url (proj , '' )
46
44
self .assertEqual (url , self .pip_latest_url )
47
45
48
- def test_project_only_htmldir (self ):
49
- proj = Project .objects .get (slug = 'pip' )
50
- proj .documentation_type = 'sphinx_htmldir'
51
- url = core_tags .make_document_url (proj )
52
- self .assertEqual (url , self .pip_latest_url )
53
- url = core_tags .make_document_url (proj , '' )
54
- self .assertEqual (url , self .pip_latest_url )
55
-
56
- def test_project_only_singlehtml (self ):
57
- proj = Project .objects .get (slug = 'pip' )
58
- proj .documentation_type = 'sphinx_singlehtml'
59
- url = core_tags .make_document_url (proj )
60
- self .assertEqual (url , self .pip_latest_url )
61
- url = core_tags .make_document_url (proj , '' )
62
- self .assertEqual (url , self .pip_latest_url )
63
-
64
46
def test_translation_project_only (self ):
65
47
proj = Project .objects .get (slug = 'pip-fr' )
66
48
url = core_tags .make_document_url (proj )
67
49
self .assertEqual (url , self .pip_latest_fr_url )
68
50
url = core_tags .make_document_url (proj , '' )
69
51
self .assertEqual (url , self .pip_latest_fr_url )
70
52
71
- def test_translation_project_only_htmldir (self ):
72
- proj = Project .objects .get (slug = 'pip-fr' )
73
- proj .documentation_type = 'sphinx_htmldir'
74
- url = core_tags .make_document_url (proj )
75
- self .assertEqual (url , self .pip_latest_fr_url )
76
- url = core_tags .make_document_url (proj , '' )
77
- self .assertEqual (url , self .pip_latest_fr_url )
78
-
79
- def test_translation_project_only_singlehtml (self ):
80
- proj = Project .objects .get (slug = 'pip-fr' )
81
- proj .documentation_type = 'sphinx_singlehtml'
82
- url = core_tags .make_document_url (proj )
83
- self .assertEqual (url , self .pip_latest_fr_url )
84
- url = core_tags .make_document_url (proj , '' )
85
- self .assertEqual (url , self .pip_latest_fr_url )
86
-
87
53
def test_project_and_version (self ):
88
54
proj = Project .objects .get (slug = 'pip' )
89
55
url = core_tags .make_document_url (proj , 'abc' )
90
56
self .assertEqual (url , self .pip_abc_url )
91
57
url = core_tags .make_document_url (proj , 'abc' , '' )
92
58
self .assertEqual (url , self .pip_abc_url )
93
59
94
- def test_project_and_version_htmldir (self ):
95
- proj = Project .objects .get (slug = 'pip' )
96
- proj .documentation_type = 'sphinx_htmldir'
97
- url = core_tags .make_document_url (proj , 'abc' )
98
- self .assertEqual (url , self .pip_abc_url )
99
- url = core_tags .make_document_url (proj , 'abc' , '' )
100
- self .assertEqual (url , self .pip_abc_url )
101
-
102
- def test_project_and_version_singlehtml (self ):
103
- proj = Project .objects .get (slug = 'pip' )
104
- proj .documentation_type = 'sphinx_singlehtml'
105
- url = core_tags .make_document_url (proj , 'abc' )
106
- self .assertEqual (url , self .pip_abc_url )
107
- url = core_tags .make_document_url (proj , 'abc' , '' )
108
- self .assertEqual (url , self .pip_abc_url )
109
-
110
60
def test_translation_project_and_version (self ):
111
61
proj = Project .objects .get (slug = 'pip-fr' )
112
62
url = core_tags .make_document_url (proj , 'abc' )
113
63
self .assertEqual (url , self .pip_abc_fr_url )
114
64
url = core_tags .make_document_url (proj , 'abc' , '' )
115
65
self .assertEqual (url , self .pip_abc_fr_url )
116
66
117
- def test_translation_project_and_version_htmldir (self ):
118
- proj = Project .objects .get (slug = 'pip-fr' )
119
- proj .documentation_type = 'sphinx_htmldir'
120
- url = core_tags .make_document_url (proj , 'abc' )
121
- self .assertEqual (url , self .pip_abc_fr_url )
122
- url = core_tags .make_document_url (proj , 'abc' , '' )
123
- self .assertEqual (url , self .pip_abc_fr_url )
124
-
125
- def test_translation_project_and_version_singlehtml (self ):
126
- proj = Project .objects .get (slug = 'pip-fr' )
127
- proj .documentation_type = 'sphinx_singlehtml'
128
- url = core_tags .make_document_url (proj , 'abc' )
129
- self .assertEqual (url , self .pip_abc_fr_url )
130
- url = core_tags .make_document_url (proj , 'abc' , '' )
131
- self .assertEqual (url , self .pip_abc_fr_url )
132
-
133
67
def test_project_and_version_and_page (self ):
134
68
proj = Project .objects .get (slug = 'pip' )
135
69
url = core_tags .make_document_url (proj , 'abc' , 'xyz' )
136
70
self .assertEqual (url , self .pip_abc_xyz_page_url )
137
- url = core_tags .make_document_url (proj , 'abc' , 'index' )
138
- self .assertEqual (url , self .pip_abc_url )
139
-
140
- def test_project_and_version_and_page_htmldir (self ):
141
- proj = Project .objects .get (slug = 'pip' )
142
- proj .documentation_type = 'sphinx_htmldir'
143
- url = core_tags .make_document_url (proj , 'abc' , 'xyz' )
144
- self .assertEqual (url , self .pip_abc_xyz_dir_url )
145
- url = core_tags .make_document_url (proj , 'abc' , 'index' )
146
- self .assertEqual (url , self .pip_abc_url )
147
-
148
- def test_project_and_version_and_page_signlehtml (self ):
149
- proj = Project .objects .get (slug = 'pip' )
150
- proj .documentation_type = 'sphinx_singlehtml'
151
- url = core_tags .make_document_url (proj , 'abc' , 'xyz' )
152
- self .assertEqual (url , self .pip_abc_xyz_document )
153
- url = core_tags .make_document_url (proj , 'abc' , 'index' )
154
- self .assertEqual (url , self .pip_abc_url )
71
+ url = core_tags .make_document_url (proj , 'abc' , 'index.html' )
72
+ self .assertEqual (url , self .pip_abc_url_index )
155
73
156
74
def test_translation_project_and_version_and_page (self ):
157
75
proj = Project .objects .get (slug = 'pip-fr' )
158
76
url = core_tags .make_document_url (proj , 'abc' , 'xyz' )
159
77
self .assertEqual (url , self .pip_abc_xyz_fr_page_url )
160
- url = core_tags .make_document_url (proj , 'abc' , 'index' )
161
- self .assertEqual (url , self .pip_abc_fr_url )
162
-
163
- def test_translation_project_and_version_and_page_htmldir (self ):
164
- proj = Project .objects .get (slug = 'pip-fr' )
165
- proj .documentation_type = 'sphinx_htmldir'
166
- url = core_tags .make_document_url (proj , 'abc' , 'xyz' )
167
- self .assertEqual (url , self .pip_abc_xyz_fr_dir_url )
168
- url = core_tags .make_document_url (proj , 'abc' , 'index' )
169
- self .assertEqual (url , self .pip_abc_fr_url )
170
-
171
- def test_translation_project_and_version_and_page_singlehtml (self ):
172
- proj = Project .objects .get (slug = 'pip-fr' )
173
- proj .documentation_type = 'sphinx_singlehtml'
174
- url = core_tags .make_document_url (proj , 'abc' , 'xyz' )
175
- self .assertEqual (url , self .pip_abc_xyz_fr_document )
176
- url = core_tags .make_document_url (proj , 'abc' , 'index' )
177
- self .assertEqual (url , self .pip_abc_fr_url )
78
+ url = core_tags .make_document_url (proj , 'abc' , 'index.html' )
79
+ self .assertEqual (url , self .pip_abc_fr_url_index )
178
80
179
81
def test_mkdocs (self ):
180
82
proj = Project .objects .get (slug = 'pip' )
@@ -188,17 +90,11 @@ def test_mkdocs_no_directory_urls(self):
188
90
url = core_tags .make_document_url (proj , LATEST , 'document.html' )
189
91
self .assertEqual (url , self .pip_latest_document_page_url )
190
92
191
- def test_mkdocs_index (self ):
192
- proj = Project .objects .get (slug = 'pip' )
193
- proj .documentation_type = 'mkdocs'
194
- url = core_tags .make_document_url (proj , LATEST , 'index' )
195
- self .assertEqual (url , self .pip_latest_url )
196
-
197
93
def test_mkdocs_index_no_directory_urls (self ):
198
94
proj = Project .objects .get (slug = 'pip' )
199
95
proj .documentation_type = 'mkdocs'
200
96
url = core_tags .make_document_url (proj , LATEST , 'index.html' )
201
- self .assertEqual (url , self .pip_latest_url )
97
+ self .assertEqual (url , self .pip_latest_url_index )
202
98
203
99
def test_restructured_text (self ):
204
100
value = '*test*'
0 commit comments