mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-13 13:05:19 +00:00
Include the plugin name in the FwupdSecurityAttr GVariant
This commit is contained in:
parent
92107e55cd
commit
b1a31dbfae
@ -777,6 +777,12 @@ fwupd_security_attr_to_variant(FwupdSecurityAttr *self)
|
||||
FWUPD_RESULT_KEY_NAME,
|
||||
g_variant_new_string(priv->name));
|
||||
}
|
||||
if (priv->plugin != NULL) {
|
||||
g_variant_builder_add(&builder,
|
||||
"{sv}",
|
||||
FWUPD_RESULT_KEY_PLUGIN,
|
||||
g_variant_new_string(priv->plugin));
|
||||
}
|
||||
if (priv->url != NULL) {
|
||||
g_variant_builder_add(&builder,
|
||||
"{sv}",
|
||||
|
@ -837,10 +837,13 @@ fwupd_security_attr_func(void)
|
||||
gboolean ret;
|
||||
g_autofree gchar *str1 = NULL;
|
||||
g_autofree gchar *str2 = NULL;
|
||||
g_autofree gchar *str3 = NULL;
|
||||
g_autofree gchar *json = NULL;
|
||||
g_autoptr(FwupdSecurityAttr) attr1 = fwupd_security_attr_new("org.fwupd.hsi.bar");
|
||||
g_autoptr(FwupdSecurityAttr) attr2 = fwupd_security_attr_new(NULL);
|
||||
g_autoptr(FwupdSecurityAttr) attr3 = NULL;
|
||||
g_autoptr(GError) error = NULL;
|
||||
g_autoptr(GVariant) data = NULL;
|
||||
g_autoptr(JsonParser) parser = json_parser_new();
|
||||
|
||||
for (guint i = 1; i < FWUPD_SECURITY_ATTR_RESULT_LAST; i++) {
|
||||
@ -901,6 +904,25 @@ fwupd_security_attr_func(void)
|
||||
g_assert_no_error(error);
|
||||
g_assert_true(ret);
|
||||
|
||||
/* roundtrip GVariant */
|
||||
data = fwupd_security_attr_to_variant(attr1);
|
||||
attr3 = fwupd_security_attr_from_variant(data);
|
||||
fwupd_security_attr_set_created(attr3, 0);
|
||||
str3 = fwupd_security_attr_to_string(attr3);
|
||||
ret = fu_test_compare_lines(str3,
|
||||
" AppstreamId: org.fwupd.hsi.baz\n"
|
||||
" HsiLevel: 2\n"
|
||||
" HsiResult: enabled\n"
|
||||
" Flags: success\n"
|
||||
" Name: DCI\n"
|
||||
" Plugin: uefi-capsule\n"
|
||||
" Uri: https://foo.bar\n"
|
||||
" Guid: af3fc12c-d090-5783-8a67-845b90d3cfec\n"
|
||||
" KEY: VALUE\n",
|
||||
&error);
|
||||
g_assert_no_error(error);
|
||||
g_assert_true(ret);
|
||||
|
||||
/* to JSON */
|
||||
json = fwupd_security_attr_to_json_string(attr1, &error);
|
||||
g_assert_no_error(error);
|
||||
|
Loading…
Reference in New Issue
Block a user