Signed-off-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx> --- tests/dbdata/os/libosinfo.org/test-db-image.xml | 9 +++++++++ tests/test-image.c | 11 +++++++++++ 2 files changed, 20 insertions(+) diff --git a/tests/dbdata/os/libosinfo.org/test-db-image.xml b/tests/dbdata/os/libosinfo.org/test-db-image.xml index d3930d3..6008df4 100644 --- a/tests/dbdata/os/libosinfo.org/test-db-image.xml +++ b/tests/dbdata/os/libosinfo.org/test-db-image.xml @@ -7,11 +7,20 @@ <vendor>libosinfo.org</vendor> <family>test</family> + <variant id="foo"> + <name>Image Foo</name> + </variant> + <variant id="bar"> + <name>Image Bar</name> + </variant> + <image arch="x86_64" format="qcow2" cloud-init="true"> + <variant id="foo"/> <url>http://libosinfo.org/db/image.qcow2</url> </image> <image arch="i686" format="vmdk"> + <variant id="bar"/> <url>http://libosinfo.org/db/image.vmdk</url> </image> </os> diff --git a/tests/test-image.c b/tests/test-image.c index e9ee642..9cabe2b 100644 --- a/tests/test-image.c +++ b/tests/test-image.c @@ -73,15 +73,26 @@ test_loaded(void) for (i = 0; i < list_len; i++) { OsinfoImage *image = OSINFO_IMAGE(osinfo_list_get_nth(OSINFO_LIST(list), i)); + OsinfoOsVariantList *variant_list; + OsinfoOsVariant *variant; + + variant_list = osinfo_image_get_os_variants(image); + g_assert_cmpint(osinfo_list_get_length(OSINFO_LIST(variant_list)), ==, 1); + + variant = OSINFO_OS_VARIANT(osinfo_list_get_nth(OSINFO_LIST(variant_list), 0)); if (g_str_equal(osinfo_image_get_architecture(image), "i686")) { g_assert_cmpstr(osinfo_image_get_url(image), ==, "http://libosinfo.org/db/image.vmdk"); g_assert_cmpstr(osinfo_image_get_format(image), ==, "vmdk"); g_assert_false(osinfo_image_get_cloud_init(image)); + g_assert_cmpstr(osinfo_entity_get_id(OSINFO_ENTITY(variant)), ==, "bar"); + g_assert_cmpstr(osinfo_os_variant_get_name(variant), ==, "Image Bar"); } else { g_assert_cmpstr(osinfo_image_get_url(image), ==, "http://libosinfo.org/db/image.qcow2"); g_assert_cmpstr(osinfo_image_get_format(image), ==, "qcow2"); g_assert_true(osinfo_image_get_cloud_init(image)); + g_assert_cmpstr(osinfo_entity_get_id(OSINFO_ENTITY(variant)), ==, "foo"); + g_assert_cmpstr(osinfo_os_variant_get_name(variant), ==, "Image Foo"); } } -- 2.20.1 _______________________________________________ Libosinfo mailing list Libosinfo@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libosinfo