Skip to content

Commit 45afe7c

Browse files
committed
Mocked out the results of 'build_images'
1 parent 24a683a commit 45afe7c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tests/cli/test_build_images.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@
1212
] = (
1313
# Images | Tags | Source | Destination | User ID | Group ID | Group Name | Dry Run
1414
# Default settings
15-
([f"test_image_{n}" for n in range(3)], [], "", "", "", "", "", False),
15+
([f"test_image_{n}" for n in range(1)], [], "", "", "", "", "", False),
1616
)
1717

1818

1919
@pytest.mark.parametrize("build_params", test_run_params_matrix)
20+
@patch("murfey.cli.build_images.run_subprocess")
2021
@patch("murfey.cli.build_images.cleanup")
2122
@patch("murfey.cli.build_images.push_images")
2223
@patch("murfey.cli.build_images.tag_image")
@@ -26,6 +27,7 @@ def test_run(
2627
mock_tag,
2728
mock_push,
2829
mock_clean,
30+
mock_subprocess,
2931
build_params: tuple[list[str], list[str], str, str, str, str, str, bool],
3032
):
3133
"""
@@ -75,6 +77,12 @@ def test_run(
7577
# Assign it to the CLI to pass to the function
7678
sys.argv = build_cmd
7779

80+
# Mock 'build_image' return value
81+
mock_build.side_effect = [
82+
f"{dst if dst else def_dst}/{image[0]}:{tags[0] if tags else def_tags[0]}"
83+
for image in images
84+
]
85+
7886
# Run the function with the command
7987
run()
8088

0 commit comments

Comments
 (0)