1
1
import os
2
2
import pathlib
3
3
import textwrap
4
+ import uuid
4
5
from unittest import mock
5
6
6
7
import django_dynamic_fixture as fixture
@@ -261,7 +262,8 @@ def test_build_respects_formats_mkdocs(self, build_docs_class, load_yaml_config)
261
262
build_docs_class .assert_called_once_with ("mkdocs" ) # HTML builder
262
263
263
264
@mock .patch ("readthedocs.doc_builder.director.load_yaml_config" )
264
- def test_build_updates_documentation_type (self , load_yaml_config ):
265
+ @mock .patch ("readthedocs.projects.tasks.builds.shutil" )
266
+ def test_build_updates_documentation_type (self , load_yaml_config , shutilmock ):
265
267
assert self .version .documentation_type == "sphinx"
266
268
load_yaml_config .return_value = get_build_config (
267
269
{
@@ -282,7 +284,9 @@ def test_build_updates_documentation_type(self, load_yaml_config):
282
284
pathlib .Path (
283
285
os .path .join (
284
286
self .project .artifact_path (version = self .version .slug , type_ = f ),
285
- f"{ self .project .slug } .{ f } " ,
287
+ # Use a random name for the offline format.
288
+ # We will automatically rename this file to filename El Proxito expects.
289
+ f"{ uuid .uuid4 ()} .{ f } " ,
286
290
)
287
291
).touch ()
288
292
@@ -296,6 +300,8 @@ def test_build_updates_documentation_type(self, load_yaml_config):
296
300
297
301
self ._trigger_update_docs_task ()
298
302
303
+ shutilmock .move .assert_called_once_with ("" , "TEST" )
304
+
299
305
# Update version state
300
306
assert self .requests_mock .request_history [8 ]._request .method == "PATCH"
301
307
assert self .requests_mock .request_history [8 ].path == "/api/v2/version/1/"
0 commit comments