|
5 | 5 |
|
6 | 6 | import pytest |
7 | 7 |
|
8 | | -from murfey.cli.build_images import build_image, push_images, run, tag_image |
| 8 | +from murfey.cli.build_images import build_image, cleanup, push_images, run, tag_image |
9 | 9 |
|
10 | 10 | images = [f"test_image_{n}" for n in range(3)] |
11 | 11 |
|
@@ -76,7 +76,7 @@ def test_build_image(mock_subprocess, mock_exists, build_params): |
76 | 76 |
|
77 | 77 |
|
78 | 78 | tag_image_params_matrix: tuple[tuple[list[str], list[str], str, bool], ...] = ( |
79 | | - # Images | Tags | Source | Destination | User ID | Group ID | Group Name | Dry Run |
| 79 | + # Images | Tags | Destination | Dry Run |
80 | 80 | # Populated flags |
81 | 81 | ( |
82 | 82 | images, |
@@ -118,7 +118,7 @@ def test_tag_image(mock_subprocess, tag_params): |
118 | 118 |
|
119 | 119 |
|
120 | 120 | push_image_params_matrix: tuple[tuple[list[str], list[str], str, bool], ...] = ( |
121 | | - # Images | Tags | Source | Destination | User ID | Group ID | Group Name | Dry Run |
| 121 | + # Images | Tags | Destination | Dry Run |
122 | 122 | # Populated flags |
123 | 123 | ( |
124 | 124 | images, |
@@ -159,6 +159,27 @@ def test_push_images( |
159 | 159 | assert result |
160 | 160 |
|
161 | 161 |
|
| 162 | +test_cleanup_params_matrix: tuple[tuple[bool], ...] = ((True,), (False,)) |
| 163 | + |
| 164 | + |
| 165 | +@pytest.mark.parametrize("cleanup_params", test_cleanup_params_matrix) |
| 166 | +@patch("murfey.cli.build_images.run_subprocess") |
| 167 | +def test_cleanup( |
| 168 | + mock_subprocess, |
| 169 | + cleanup_params, |
| 170 | +): |
| 171 | + |
| 172 | + # Unpack test params |
| 173 | + (dry_run,) = cleanup_params |
| 174 | + |
| 175 | + # Mock the subprocess return value |
| 176 | + mock_subprocess.return_value = 0 |
| 177 | + |
| 178 | + # Run the function |
| 179 | + result = cleanup(dry_run) |
| 180 | + assert result |
| 181 | + |
| 182 | + |
162 | 183 | test_run_params_matrix: tuple[ |
163 | 184 | tuple[list[str], list[str], str, str, str, str, str, bool], ... |
164 | 185 | ] = ( |
|
0 commit comments