|
11 | 11 | BUILD_STATUS_FAILURE,
|
12 | 12 | BUILD_STATUS_SUCCESS,
|
13 | 13 | EXTERNAL,
|
14 |
| - TAG, |
15 | 14 | )
|
16 | 15 | from readthedocs.builds.models import Build
|
17 | 16 | from readthedocs.config import ALL, ConfigError
|
|
22 | 21 | from readthedocs.projects.models import EnvironmentVariable, Project, WebHookEvent
|
23 | 22 | from readthedocs.projects.tasks.builds import sync_repository_task, update_docs_task
|
24 | 23 | from readthedocs.telemetry.models import BuildData
|
25 |
| -from readthedocs.vcs_support.backends.git import Backend |
26 | 24 |
|
27 | 25 | from .mockers import BuildEnvironmentMocker
|
28 | 26 |
|
@@ -62,19 +60,17 @@ def _get_project(self):
|
62 | 60 | return fixture.get(
|
63 | 61 | Project,
|
64 | 62 | slug="project",
|
65 |
| - repo="https://github.com/readthedocs/readthedocs.org", |
66 | 63 | enable_epub_build=True,
|
67 | 64 | enable_pdf_build=True,
|
68 | 65 | )
|
69 | 66 |
|
70 |
| - def _trigger_update_docs_task(self, **kwargs): |
| 67 | + def _trigger_update_docs_task(self): |
71 | 68 | # NOTE: is it possible to replace calling this directly by `trigger_build` instead? :)
|
72 |
| - kwargs.setdefault("build_api_key", "1234") |
73 |
| - kwargs.setdefault("build_commit", self.build.commit) |
74 | 69 | return update_docs_task.delay(
|
75 | 70 | self.version.pk,
|
76 | 71 | self.build.pk,
|
77 |
| - **kwargs, |
| 72 | + build_api_key="1234", |
| 73 | + build_commit=self.build.commit, |
78 | 74 | )
|
79 | 75 |
|
80 | 76 | class TestCustomConfigFile(BuildEnvironmentBase):
|
@@ -694,72 +690,6 @@ def test_failed_build(
|
694 | 690 | assert revoke_key_request._request.method == "POST"
|
695 | 691 | assert revoke_key_request.path == "/api/v2/revoke/"
|
696 | 692 |
|
697 |
| - @mock.patch.object(Backend, "ref_exists") |
698 |
| - @mock.patch("readthedocs.doc_builder.director.load_yaml_config") |
699 |
| - def test_checkout_tag_by_name(self, load_yaml_config, ref_exists): |
700 |
| - ref_exists.return_value = False |
701 |
| - self.version.type = TAG |
702 |
| - self.version.identifier = "abc123" |
703 |
| - self.version.verbose_name = "v1.0" |
704 |
| - self.version.slug = "v1.0" |
705 |
| - self.machine = False |
706 |
| - self.version.save() |
707 |
| - load_yaml_config.return_value = get_build_config({}) |
708 |
| - |
709 |
| - self._trigger_update_docs_task(build_commit=None) |
710 |
| - |
711 |
| - self.mocker.mocks["git.Backend.run"].assert_has_calls( |
712 |
| - [ |
713 |
| - mock.call("git", "clone", "--depth", "1", mock.ANY, "."), |
714 |
| - mock.call( |
715 |
| - "git", |
716 |
| - "fetch", |
717 |
| - "origin", |
718 |
| - "--force", |
719 |
| - "--prune", |
720 |
| - "--prune-tags", |
721 |
| - "--depth", |
722 |
| - "50", |
723 |
| - "refs/tags/v1.0:refs/tags/v1.0", |
724 |
| - ), |
725 |
| - mock.call("git", "checkout", "--force", "v1.0"), |
726 |
| - mock.call("git", "clean", "-d", "-f", "-f"), |
727 |
| - ] |
728 |
| - ) |
729 |
| - |
730 |
| - @mock.patch.object(Backend, "ref_exists") |
731 |
| - @mock.patch("readthedocs.doc_builder.director.load_yaml_config") |
732 |
| - def test_checkout_external_version_by_commit(self, load_yaml_config, ref_exists): |
733 |
| - ref_exists.return_value = False |
734 |
| - self.version.type = EXTERNAL |
735 |
| - self.version.identifier = "abc123" |
736 |
| - self.version.verbose_name = "22" |
737 |
| - self.version.slug = "22" |
738 |
| - self.machine = False |
739 |
| - self.version.save() |
740 |
| - load_yaml_config.return_value = get_build_config({}) |
741 |
| - |
742 |
| - self._trigger_update_docs_task(build_commit=None) |
743 |
| - |
744 |
| - self.mocker.mocks["git.Backend.run"].assert_has_calls( |
745 |
| - [ |
746 |
| - mock.call("git", "clone", "--depth", "1", mock.ANY, "."), |
747 |
| - mock.call( |
748 |
| - "git", |
749 |
| - "fetch", |
750 |
| - "origin", |
751 |
| - "--force", |
752 |
| - "--prune", |
753 |
| - "--prune-tags", |
754 |
| - "--depth", |
755 |
| - "50", |
756 |
| - "pull/22/head:external-22", |
757 |
| - ), |
758 |
| - mock.call("git", "checkout", "--force", "abc123"), |
759 |
| - mock.call("git", "clean", "-d", "-f", "-f"), |
760 |
| - ] |
761 |
| - ) |
762 |
| - |
763 | 693 | @mock.patch("readthedocs.doc_builder.director.load_yaml_config")
|
764 | 694 | def test_build_commands_executed(
|
765 | 695 | self,
|
|
0 commit comments