[libosinfo PATCH 2/3] test-os: expand test_loader() to cover loading treeinfo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Fabiano Fidêncio <fabiano@xxxxxxxxxxxx>
---
 tests/dbdata/os/fedoraproject.org/fedora-16.xml |  9 +++++++++
 tests/test-os.c                                 | 18 ++++++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/tests/dbdata/os/fedoraproject.org/fedora-16.xml b/tests/dbdata/os/fedoraproject.org/fedora-16.xml
index 88ef431..c67ce23 100644
--- a/tests/dbdata/os/fedoraproject.org/fedora-16.xml
+++ b/tests/dbdata/os/fedoraproject.org/fedora-16.xml
@@ -19,5 +19,14 @@
       <kernel>isolinux/vmlinuz</kernel>
       <initrd>isolinux/initrd.img</initrd>
     </media>
+
+    <tree arch="i686">
+      <url>http://archive.fedoraproject.org/pub/archive/fedora/linux/releases/16/Fedora/i386/os/</url>
+      <treeinfo>
+        <family>Fedora</family>
+        <version>16</version>
+        <arch>i386</arch>
+      </treeinfo>
+    </tree>
   </os>
 </libosinfo>
diff --git a/tests/test-os.c b/tests/test-os.c
index 0b586b2..1756e59 100644
--- a/tests/test-os.c
+++ b/tests/test-os.c
@@ -67,6 +67,8 @@ test_loader(void)
     OsinfoLoader *loader;
     OsinfoDb *db;
     OsinfoOs *os;
+    OsinfoTreeList *treelist;
+    OsinfoTree *tree;
     GError *error = NULL;
     const char *str;
 
@@ -124,6 +126,20 @@ test_loader(void)
                           "*(osinfo_entity_get_param_value_enum): should not be reached*");
     g_assert_cmpint(osinfo_os_get_release_status(os), ==, OSINFO_RELEASE_STATUS_RELEASED);
 
+    os = osinfo_db_get_os(db, "http://fedoraproject.org/fedora/16";);
+    g_assert_nonnull(os);
+    str = osinfo_product_get_short_id(OSINFO_PRODUCT(os));
+    g_assert_cmpstr(str, ==, "fedora16");
+    treelist = osinfo_os_get_tree_list(os);
+    g_assert_cmpint(osinfo_list_get_length(OSINFO_LIST(treelist)), ==, 1);
+    tree = OSINFO_TREE(osinfo_list_get_nth(OSINFO_LIST(treelist), 0));
+    str = osinfo_tree_get_treeinfo_family(tree);
+    g_assert_cmpstr(str, ==, "Fedora");
+    str = osinfo_tree_get_treeinfo_version(tree);
+    g_assert_cmpstr(str, ==, "16");
+    str = osinfo_tree_get_treeinfo_arch(tree);
+    g_assert_cmpstr(str, ==, "i386");
+
     g_object_unref(loader);
 }
 
@@ -908,6 +924,8 @@ main(int argc, char *argv[])
     osinfo_filter_get_type();
     osinfo_resources_get_type();
     osinfo_resourceslist_get_type();
+    osinfo_tree_get_type();
+    osinfo_treelist_get_type();
 
     return g_test_run();
 }
-- 
1.8.3.1

_______________________________________________
Libosinfo mailing list
Libosinfo@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libosinfo




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux