Skip to content

Commit 32e344d

Browse files
committed
test: Cover defensive type-check branches in W4002 rule
Adds parametrized cases for malformed Metadata Interface structures: - ParameterGroups with non-dict entries - ParameterGroups where Parameters contains non-string entries Brings patch coverage on InterfaceParameterInGroup.py to 100%.
1 parent 0c5ccb4 commit 32e344d

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

test/unit/rules/metadata/test_interface_parameter_in_group.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,25 @@ def template():
7171
"invalid",
7272
0,
7373
),
74+
(
75+
"Non-dict entries in ParameterGroups are skipped",
76+
{
77+
"ParameterGroups": [
78+
"not-a-dict",
79+
{"Parameters": ["VpcId", "SubnetId"]},
80+
]
81+
},
82+
0,
83+
),
84+
(
85+
"Non-string entries in Parameters are skipped",
86+
{
87+
"ParameterGroups": [
88+
{"Parameters": [{"Ref": "VpcId"}, "SubnetId"]},
89+
]
90+
},
91+
1,
92+
),
7493
],
7594
)
7695
def test_validate(name, instance, expected_count, rule, validator):

0 commit comments

Comments
 (0)