5
5
import django_dynamic_fixture as fixture
6
6
import mock
7
7
from django .conf import settings
8
- from django .core .files .storage import Storage
9
8
from django .http import HttpResponse
10
9
from django .test .utils import override_settings
11
10
from django .urls import reverse
@@ -126,7 +125,7 @@ class TestDocServingBackends(BaseDocServing):
126
125
@override_settings (PYTHON_MEDIA = True )
127
126
def test_python_media_serving (self ):
128
127
with mock .patch (
129
- 'readthedocs.proxito.views.serve' , return_value = HttpResponse ()) as serve_mock :
128
+ 'readthedocs.proxito.views.mixins. serve' , return_value = HttpResponse ()) as serve_mock :
130
129
url = '/en/latest/awesome.html'
131
130
host = 'project.dev.readthedocs.io'
132
131
self .client .get (url , HTTP_HOST = host )
@@ -173,7 +172,7 @@ def test_default_robots_txt(self):
173
172
b'User-agent: *\n Allow: /\n Sitemap: https://project.readthedocs.io/sitemap.xml\n '
174
173
)
175
174
176
- @mock .patch ('readthedocs.proxito.views.get_storage_class' )
175
+ @mock .patch ('readthedocs.proxito.views.serve. get_storage_class' )
177
176
def test_custom_robots_txt (self , storage_mock ):
178
177
self .project .versions .update (active = True , built = True )
179
178
storage_mock ()().exists .return_value = True
@@ -185,7 +184,7 @@ def test_custom_robots_txt(self, storage_mock):
185
184
response ['x-accel-redirect' ], '/proxito/html/project/latest/robots.txt' ,
186
185
)
187
186
188
- @mock .patch ('readthedocs.proxito.views.get_storage_class' )
187
+ @mock .patch ('readthedocs.proxito.views.serve. get_storage_class' )
189
188
def test_directory_indexes (self , storage_mock ):
190
189
self .project .versions .update (active = True , built = True )
191
190
storage_mock ()().exists .return_value = True
@@ -201,7 +200,7 @@ def test_directory_indexes(self, storage_mock):
201
200
response ['location' ], '/en/latest/index-exists/' ,
202
201
)
203
202
204
- @mock .patch ('readthedocs.proxito.views.get_storage_class' )
203
+ @mock .patch ('readthedocs.proxito.views.serve. get_storage_class' )
205
204
def test_directory_indexes_readme_serving (self , storage_mock ):
206
205
self .project .versions .update (active = True , built = True )
207
206
@@ -218,7 +217,7 @@ def test_directory_indexes_readme_serving(self, storage_mock):
218
217
response ['location' ], '/en/latest/readme-exists/README.html' ,
219
218
)
220
219
221
- @mock .patch ('readthedocs.proxito.views.get_storage_class' )
220
+ @mock .patch ('readthedocs.proxito.views.serve. get_storage_class' )
222
221
def test_directory_indexes_get_args (self , storage_mock ):
223
222
self .project .versions .update (active = True , built = True )
224
223
storage_mock ()().exists .return_value = True
@@ -234,7 +233,7 @@ def test_directory_indexes_get_args(self, storage_mock):
234
233
response ['location' ], '/en/latest/index-exists/?foo=bar' ,
235
234
)
236
235
237
- @mock .patch ('readthedocs.proxito.views.get_storage_class' )
236
+ @mock .patch ('readthedocs.proxito.views.serve. get_storage_class' )
238
237
def test_404_storage_serves_404 (self , storage_mock ):
239
238
self .project .versions .update (active = True , built = True )
240
239
@@ -254,7 +253,7 @@ def test_404_storage_serves_404(self, storage_mock):
254
253
response .status_code , 404
255
254
)
256
255
257
- @mock .patch ('readthedocs.proxito.views.get_storage_class' )
256
+ @mock .patch ('readthedocs.proxito.views.serve. get_storage_class' )
258
257
def test_404_storage_paths_checked (self , storage_mock ):
259
258
self .project .versions .update (active = True , built = True )
260
259
storage_mock ()().exists .return_value = False
0 commit comments