Skip to content

Commit ec31662

Browse files
committed
Add new basic tests
1 parent ab47ad5 commit ec31662

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

src/confcom/azext_confcom/tests/latest/test_confcom_acipolicygen_arm.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,4 +252,45 @@ def test_acipolicygen_arm_diff_with_allow_all():
252252
}
253253

254254

255+
@pytest.mark.parametrize(
256+
"container_definitions",
257+
[
258+
["{}"], # Single empty container definition (use all default values)
259+
["{}", "{}"], # Two empty container definitions
260+
["[{}]", "{}"], # Two empty container definitions, one in subarray
261+
["[{}, {}]", "{}"], # Three empty container definitions, two in subarray
262+
['{"id": "test"}'], # Single container definition a field changed
263+
]
264+
)
265+
def test_acipolicygen_with_containers(container_definitions):
266+
267+
acipolicygen_confcom(
268+
input_path=None,
269+
arm_template=None,
270+
arm_template_parameters=None,
271+
image_name=None,
272+
virtual_node_yaml_path=None,
273+
infrastructure_svn=None,
274+
tar_mapping_location=None,
275+
outraw=True,
276+
container_definitions=[json.loads(c) for c in container_definitions]
277+
)
255278

279+
280+
def test_acipolicygen_with_containers_field_changed():
281+
282+
buffer = io.StringIO()
283+
with contextlib.redirect_stdout(buffer):
284+
acipolicygen_confcom(
285+
input_path=None,
286+
arm_template=None,
287+
arm_template_parameters=None,
288+
image_name=None,
289+
virtual_node_yaml_path=None,
290+
infrastructure_svn=None,
291+
tar_mapping_location=None,
292+
outraw=True,
293+
container_definitions=[json.loads('{"id": "test"}')]
294+
)
295+
actual_policy = buffer.getvalue()
296+
assert '"id":"test"' in actual_policy

0 commit comments

Comments
 (0)