libnm/tests: check property meta data for secrets

This commit is contained in:
Thomas Haller 2021-07-27 14:31:15 +02:00
parent 675dd0edd7
commit b06aed2d66
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -4672,6 +4672,24 @@ check_done:;
g_assert(!NM_FLAGS_HAS(sip->param_spec->flags, G_PARAM_CONSTRUCT));
g_assert(!NM_FLAGS_HAS(sip->param_spec->flags, G_PARAM_CONSTRUCT_ONLY));
if (NM_FLAGS_HAS(sip->param_spec->flags, NM_SETTING_PARAM_SECRET)) {
if (sip->param_spec->value_type == G_TYPE_STRING) {
g_assert_cmpstr(NM_G_PARAM_SPEC_GET_DEFAULT_STRING(sip->param_spec),
==,
NULL);
} else if (sip->param_spec->value_type == G_TYPE_BYTES) {
/* pass */
} else if (sip->param_spec->value_type == G_TYPE_HASH_TABLE) {
g_assert(NM_IS_SETTING_VPN(setting));
g_assert_cmpstr(sip->name, ==, NM_SETTING_VPN_SECRETS);
} else {
g_error("secret %s.%s is of unexpected property type %s",
nm_setting_get_name(setting),
sip->name,
g_type_name(sip->param_spec->value_type));
}
}
}
}