Skip to content

Commit 8d6978d

Browse files
committed
Checked that 'push_images' and 'cleanup
' are called correctly
1 parent 42dfc87 commit 8d6978d

File tree

1 file changed

+46
-1
lines changed

1 file changed

+46
-1
lines changed

tests/cli/test_build_images.py

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,37 @@
2020

2121

2222
test_run_params_matrix: tuple[
23-
tuple[list[str], list[str], str, str, str, str, str, bool]
23+
tuple[list[str], list[str], str, str, str, str, str, bool], ...
2424
] = (
2525
# Images | Tags | Source | Destination | User ID | Group ID | Group Name | Dry Run
2626
# Default settings
2727
(images, [], "", "", "", "", "", False),
28+
(
29+
images,
30+
[
31+
"latest",
32+
"dev",
33+
],
34+
"",
35+
"docker.io",
36+
"12345",
37+
"34567",
38+
"my-group",
39+
False,
40+
),
41+
(
42+
images,
43+
[
44+
"latest",
45+
"dev",
46+
],
47+
"",
48+
"docker.io",
49+
"12345",
50+
"34567",
51+
"my-group",
52+
True,
53+
),
2854
)
2955

3056

@@ -129,7 +155,9 @@ def test_run(
129155
)
130156
mock_build.assert_has_calls(expected_build_calls, any_order=True)
131157

158+
# Check that 'tag_image' was called with the correct arguments
132159
if other_tags:
160+
assert mock_tag.call_count == len(images) * len(other_tags)
133161
expected_tag_calls = (
134162
call(
135163
image_path=image,
@@ -139,3 +167,20 @@ def test_run(
139167
for image in built_images
140168
)
141169
mock_tag.assert_has_calls(expected_tag_calls, any_order=True)
170+
171+
# Check that 'push_images' was called with the correct arguments
172+
mock_push.assert_called_once_with(
173+
call(
174+
images=images_to_push,
175+
dry_run=dry_run if dry_run else def_dry_run,
176+
),
177+
any_order=True,
178+
)
179+
180+
# Check that 'cleanup' was called correctly
181+
mock_clean.assert_called_once_with(
182+
call(
183+
dry_run=dry_run if dry_run else def_dry_run,
184+
),
185+
any_order=True,
186+
)

0 commit comments

Comments
 (0)