fix api2::types::ACL_ROLE_SCHEMA

make sure we list all roles ...
This commit is contained in:
Dietmar Maurer
2020-04-28 13:25:02 +02:00
parent dd335b77f5
commit 409f44247b
2 changed files with 27 additions and 1 deletions

View File

@ -142,3 +142,27 @@ fn verify_root_api() -> Result<(), Error> {
Ok(())
}
#[test]
fn verify_acl_role_schema() -> Result<(), Error> {
let list = match api2::types::ACL_ROLE_SCHEMA {
Schema::String(StringSchema { format: Some(ApiStringFormat::Enum(list)), .. }) => list,
_ => unreachable!(),
};
let map = &proxmox_backup::config::acl::ROLE_NAMES;
for item in *list {
if !map.contains_key(item) {
bail!("found role '{}' without description/mapping", item);
}
}
for role in map.keys() {
if !list.contains(role) {
bail!("role '{}' missing in ACL_ROLE_SCHEMA enum", role);
}
}
Ok(())
}