1
1
import mock
2
2
from django .contrib .sessions .backends .base import SessionBase
3
3
from django .test import TestCase
4
+ from django .test .utils import override_settings
4
5
from rest_framework .test import APIRequestFactory , APITestCase
5
6
6
7
from readthedocs .api .v2 .views .footer_views import (
@@ -114,6 +115,10 @@ def test_not_show_edit_on_github(self):
114
115
self .assertNotIn ('Edit' , response .data ['html' ])
115
116
116
117
118
+ @override_settings (
119
+ USE_SUBDOMAIN = True ,
120
+ PUBLIC_DOMAIN = 'readthedocs.io' ,
121
+ )
117
122
class TestVersionCompareFooter (TestCase ):
118
123
fixtures = ['test_data' ]
119
124
@@ -124,7 +129,7 @@ def test_highest_version_from_stable(self):
124
129
base_version = self .pip .get_stable_version ()
125
130
valid_data = {
126
131
'project' : 'Version 0.8.1 of Pip (19)' ,
127
- 'url' : '/dashboard /pip/version /0.8.1/' ,
132
+ 'url' : 'http:/ /pip.readthedocs.io/en /0.8.1/' ,
128
133
'slug' : '0.8.1' ,
129
134
'version' : '0.8.1' ,
130
135
'is_highest' : True ,
@@ -136,7 +141,7 @@ def test_highest_version_from_lower(self):
136
141
base_version = self .pip .versions .get (slug = '0.8' )
137
142
valid_data = {
138
143
'project' : 'Version 0.8.1 of Pip (19)' ,
139
- 'url' : '/dashboard /pip/version /0.8.1/' ,
144
+ 'url' : 'http:/ /pip.readthedocs.io/en /0.8.1/' ,
140
145
'slug' : '0.8.1' ,
141
146
'version' : '0.8.1' ,
142
147
'is_highest' : False ,
@@ -149,7 +154,7 @@ def test_highest_version_from_latest(self):
149
154
base_version = self .pip .versions .get (slug = LATEST )
150
155
valid_data = {
151
156
'project' : 'Version 0.8.1 of Pip (19)' ,
152
- 'url' : '/dashboard /pip/version /0.8.1/' ,
157
+ 'url' : 'http:/ /pip.readthedocs.io/en /0.8.1/' ,
153
158
'slug' : '0.8.1' ,
154
159
'version' : '0.8.1' ,
155
160
'is_highest' : True ,
@@ -177,7 +182,7 @@ def test_highest_version_over_branches(self):
177
182
base_version = self .pip .versions .get (slug = '0.8.1' )
178
183
valid_data = {
179
184
'project' : 'Version 1.0.0 of Pip ({})' .format (version .pk ),
180
- 'url' : '/dashboard /pip/version /1.0.0/' ,
185
+ 'url' : 'http:/ /pip.readthedocs.io/en /1.0.0/' ,
181
186
'slug' : '1.0.0' ,
182
187
'version' : '1.0.0' ,
183
188
'is_highest' : False ,
@@ -191,7 +196,7 @@ def test_highest_version_without_tags(self):
191
196
base_version = self .pip .versions .get (slug = '0.8.1' )
192
197
valid_data = {
193
198
'project' : 'Version 0.8.1 of Pip (19)' ,
194
- 'url' : '/dashboard /pip/version /0.8.1/' ,
199
+ 'url' : 'http:/ /pip.readthedocs.io/en /0.8.1/' ,
195
200
'slug' : '0.8.1' ,
196
201
'version' : '0.8.1' ,
197
202
'is_highest' : True ,
@@ -202,7 +207,7 @@ def test_highest_version_without_tags(self):
202
207
base_version = self .pip .versions .get (slug = '0.8' )
203
208
valid_data = {
204
209
'project' : 'Version 0.8.1 of Pip (19)' ,
205
- 'url' : '/dashboard /pip/version /0.8.1/' ,
210
+ 'url' : 'http:/ /pip.readthedocs.io/en /0.8.1/' ,
206
211
'slug' : '0.8.1' ,
207
212
'version' : '0.8.1' ,
208
213
'is_highest' : False ,
@@ -219,7 +224,7 @@ def test_highest_version_without_tags(self):
219
224
)
220
225
valid_data = {
221
226
'project' : 'Version 2.0.0 of Pip ({})' .format (version .pk ),
222
- 'url' : '/dashboard /pip/version /2.0.0/' ,
227
+ 'url' : 'http:/ /pip.readthedocs.io/en /2.0.0/' ,
223
228
'slug' : '2.0.0' ,
224
229
'version' : '2.0.0' ,
225
230
'is_highest' : False ,
@@ -235,11 +240,12 @@ class TestFooterPerformance(APITestCase):
235
240
236
241
# The expected number of queries for generating the footer
237
242
# This shouldn't increase unless we modify the footer API
238
- EXPECTED_QUERIES = 9
243
+ EXPECTED_QUERIES = 13
239
244
240
245
def setUp (self ):
241
246
self .pip = Project .objects .get (slug = 'pip' )
242
247
self .pip .versions .create_latest ()
248
+ self .pip .versions .update (built = True )
243
249
244
250
def render (self ):
245
251
request = self .factory .get (self .url )
0 commit comments