meta: ensure caps always a set
When loaded directly from JSON the caps are a list while they're expected to be a set.
This commit is contained in:
parent
adea7d2acd
commit
6b4bb850a7
2 changed files with 3 additions and 3 deletions
|
|
@ -514,7 +514,7 @@ class ModuleInfo:
|
|||
},
|
||||
"desc": meta.get("summary", "no summary provided"),
|
||||
"info": long_description,
|
||||
"caps": meta.get("capabilities", set()),
|
||||
"caps": set(meta.get("capabilities", [])),
|
||||
}
|
||||
return cls(klass, name, path, info)
|
||||
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@ def test_load_from_json(tmp_path):
|
|||
modinfo = osbuild.meta.ModuleInfo.load(tmp_path, "Stage", "org.osbuild.noop")
|
||||
assert modinfo.desc == "some json summary"
|
||||
assert modinfo.info == "long text\nwith newlines"
|
||||
assert modinfo.caps == ["CAP_MAC_ADMIN", "CAP_BIG_MAC"]
|
||||
assert modinfo.caps == set(["CAP_MAC_ADMIN", "CAP_BIG_MAC"])
|
||||
assert modinfo.opts == {
|
||||
"1": {"properties": {"json_filename": {"type": "string"}}},
|
||||
"2": {},
|
||||
|
|
@ -304,7 +304,7 @@ def test_load_from_json_prefered(tmp_path):
|
|||
modinfo = osbuild.meta.ModuleInfo.load(tmp_path, "Stage", "org.osbuild.noop")
|
||||
assert modinfo.desc == "some json summary"
|
||||
assert modinfo.info == "long text\nwith newlines"
|
||||
assert modinfo.caps == ["CAP_MAC_ADMIN", "CAP_BIG_MAC"]
|
||||
assert modinfo.caps == set(["CAP_MAC_ADMIN", "CAP_BIG_MAC"])
|
||||
assert modinfo.opts == {
|
||||
"1": {},
|
||||
"2": {"json_devices": {"type": "object"}},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue