Listing built-in policies will now hide older versions, unless -v is used.

This commit is contained in:
Joe Testa
2024-10-11 15:43:09 -04:00
parent 3220043aaf
commit c0133a8d5f
3 changed files with 45 additions and 9 deletions

View File

@ -52,6 +52,14 @@ class TestPolicy:
version_str = " (version %s)" % BUILTIN_POLICIES[policy_name]['version']
assert policy_name.endswith(version_str)
# Ensure version field is a string, but can be parsed as an integer.
version_field = BUILTIN_POLICIES[policy_name]['version']
assert type(version_field) is str
try:
int(version_field)
except ValueError:
assert False, "version field of %s policy is not parseable as an integer." % policy_name
# Ensure no extra fields are present.
assert len(required_fields) == len(BUILTIN_POLICIES[policy_name])