Skip to content

Commit 5d998bd

Browse files
committed
mock fetch.check_url to remove network dependency in git clone test
Signed-off-by: tdruez <tdruez@aboutcode.org>
1 parent cd19409 commit 5d998bd

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

scanpipe/tests/test_pipelines.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,10 @@ def test_scanpipe_pipeline_class_download_fetch_exception(self, mock_fetch):
265265
self.assertIn("https://download.url/file.zip could not be fetched.", run.log)
266266

267267
@mock.patch("git.repo.base.Repo.clone_from")
268-
def test_scanpipe_pipeline_class_download_missing_inputs_git_repo(self, mock_clone):
268+
@mock.patch("scanpipe.pipes.fetch.check_url", return_value=True)
269+
def test_scanpipe_pipeline_class_download_missing_inputs_git_repo(
270+
self, mock_check_url, mock_clone
271+
):
269272
project1 = make_project()
270273
run = project1.add_pipeline("do_nothing")
271274
pipeline = run.make_pipeline_instance()
@@ -818,7 +821,10 @@ def test_scanpipe_scan_package_single_file(self):
818821
self.assertPipelineResultEqual(expected_file, scancode_file)
819822

820823
@mock.patch("git.repo.base.Repo.clone_from")
821-
def test_scanpipe_scan_package_single_package_git_repo(self, mock_clone):
824+
@mock.patch("scanpipe.pipes.fetch.check_url", return_value=True)
825+
def test_scanpipe_scan_package_single_package_git_repo(
826+
self, mock_check_url, mock_clone
827+
):
822828
pipeline_name = "scan_single_package"
823829
project1 = make_project()
824830

0 commit comments

Comments
 (0)