Skip to content

Commit be2f38e

Browse files
committed
Accidentally removed a patched function from 'run()' test; fixed incorrect return code for mocked subprocess; fixed incorrect order to variables and the functions they are passed into
1 parent 9048529 commit be2f38e

File tree

1 file changed

+32
-31
lines changed

1 file changed

+32
-31
lines changed

tests/cli/test_build_images.py

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -117,36 +117,6 @@ def test_tag_image(mock_subprocess, tag_params):
117117
assert image_tags == [f"{built_image.split(':')[0]}:{tag}" for tag in tags[1:]]
118118

119119

120-
test_run_params_matrix: tuple[
121-
tuple[list[str], list[str], str, str, str, str, str, bool], ...
122-
] = (
123-
# Images | Tags | Source | Destination | User ID | Group ID | Group Name | Dry Run
124-
# Default settings
125-
(images, [], "", "", "", "", "", False),
126-
# Populated flags
127-
(
128-
images,
129-
["latest", "dev", "1.1.1"],
130-
"",
131-
"docker.io",
132-
"12345",
133-
"34567",
134-
"my-group",
135-
False,
136-
),
137-
(
138-
images,
139-
["latest", "dev", "1.1.1"],
140-
"",
141-
"docker.io",
142-
"12345",
143-
"34567",
144-
"my-group",
145-
True,
146-
),
147-
)
148-
149-
150120
push_image_params_matrix: tuple[tuple[list[str], list[str], str, bool], ...] = (
151121
# Images | Tags | Source | Destination | User ID | Group ID | Group Name | Dry Run
152122
# Populated flags
@@ -179,7 +149,7 @@ def test_push_images(
179149
images_to_push = [f"{dst}/{image}:{tag}" for image in images for tag in tags]
180150

181151
# Mock the subprocess return value
182-
mock_subprocess.return_value = True
152+
mock_subprocess.return_value = 0
183153

184154
# Run the function
185155
result = push_images(
@@ -189,8 +159,39 @@ def test_push_images(
189159
assert result
190160

191161

162+
test_run_params_matrix: tuple[
163+
tuple[list[str], list[str], str, str, str, str, str, bool], ...
164+
] = (
165+
# Images | Tags | Source | Destination | User ID | Group ID | Group Name | Dry Run
166+
# Default settings
167+
(images, [], "", "", "", "", "", False),
168+
# Populated flags
169+
(
170+
images,
171+
["latest", "dev", "1.1.1"],
172+
"",
173+
"docker.io",
174+
"12345",
175+
"34567",
176+
"my-group",
177+
False,
178+
),
179+
(
180+
images,
181+
["latest", "dev", "1.1.1"],
182+
"",
183+
"docker.io",
184+
"12345",
185+
"34567",
186+
"my-group",
187+
True,
188+
),
189+
)
190+
191+
192192
@pytest.mark.parametrize("run_params", test_run_params_matrix)
193193
@patch("murfey.cli.build_images.Path.exists")
194+
@patch("murfey.cli.build_images.run_subprocess")
194195
@patch("murfey.cli.build_images.cleanup")
195196
@patch("murfey.cli.build_images.push_images")
196197
@patch("murfey.cli.build_images.tag_image")

0 commit comments

Comments
 (0)