Skip to content

Commit b2cf020

Browse files
committed
Add test coverage for permission fixture files.
Parse all JSON and YAML fixtures in tests/permission_files through provider-kubeconfig helpers to validate real file-based inputs used in manual update/revoke checks. Made-with: Cursor
1 parent 15ee238 commit b2cf020

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/test_provider_kubeconfig.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,26 @@ def test_parse_permission_rules_non_apigroup_without_marker_appends_empty_rule(s
141141
self.assertEqual(rules[0], {})
142142
self.assertEqual(resources, ["not-a-url"])
143143

144+
def test_permission_fixture_files_parse_json_and_yaml(self):
145+
"""Fixture files in tests/permission_files should load and parse via script helpers."""
146+
fixture_dir = os.path.join(ROOT, "tests", "permission_files")
147+
fixture_files = [
148+
"permissions-example1.json",
149+
"permissions-example1.yaml",
150+
"permissions-example2.json",
151+
"permissions-example2.yaml",
152+
"permissions-example3.json",
153+
"permissions-example3.yaml",
154+
]
155+
for name in fixture_files:
156+
path = os.path.join(fixture_dir, name)
157+
self.assertTrue(os.path.exists(path), f"Missing fixture file: {name}")
158+
perms = self.generator._load_permission_data(path)
159+
rules, resources = self.generator._parse_permission_rules(perms)
160+
self.assertIsInstance(perms, dict, f"{name}: perms should be dict")
161+
self.assertGreater(len(rules), 0, f"{name}: expected at least one parsed rule")
162+
self.assertGreater(len(resources), 0, f"{name}: expected at least one parsed resource")
163+
144164

145165
class TestKubeconfigIntegration(unittest.TestCase):
146166
"""

0 commit comments

Comments
 (0)