[libosinfo PATCH 6/7] test-install-script: Cover _(get|set)_installation_source()

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

 



Signed-off-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx>
---
 tests/test-install-script.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/tests/test-install-script.c b/tests/test-install-script.c
index 4caf5fe..9252423 100644
--- a/tests/test-install-script.c
+++ b/tests/test-install-script.c
@@ -321,6 +321,29 @@ test_preferred_injection_method(void)
     g_object_unref(db);
 }
 
+static void
+test_installation_source(void)
+{
+    OsinfoLoader *loader;
+    OsinfoDb *db;
+    OsinfoInstallScript *script;
+
+    loader = osinfo_loader_new();
+    osinfo_loader_process_path(loader, SRCDIR "/tests/dbdata", &error);
+    g_assert_no_error(error);
+    db = g_object_ref(osinfo_loader_get_db(loader));
+    g_object_unref(loader);
+
+    script = osinfo_db_get_install_script(db, "http://example.com/libosinfo/test-install-script";);
+    g_assert_nonnull(script);
+
+    g_assert_true(osinfo_install_script_get_installation_source(script) == OSINFO_INSTALL_SCRIPT_INSTALLATION_SOURCE_MEDIA);
+    osinfo_install_script_set_installation_source(script, OSINFO_INSTALL_SCRIPT_INSTALLATION_SOURCE_NETWORK);
+    g_assert_true(osinfo_install_script_get_installation_source(script) == OSINFO_INSTALL_SCRIPT_INSTALLATION_SOURCE_NETWORK);
+
+    g_object_unref(db);
+}
+
 int
 main(int argc, char *argv[])
 {
@@ -330,6 +353,7 @@ main(int argc, char *argv[])
     g_test_add_func("/install-script/script_data", test_script_data);
     g_test_add_func("/install-script/script_datamap", test_script_datamap);
     g_test_add_func("/install-script/preferred_injection_method", test_preferred_injection_method);
+    g_test_add_func("/install-script/installation_source", test_installation_source);
 
     /* Upfront so we don't confuse valgrind */
     osinfo_entity_get_type();
-- 
2.19.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