[Libosinfo] [libosinfo PATCH v2 4/5] test-install-script: Cover _(get|set)_installation_source()

Fabiano Fidêncio fidencio at redhat.com
Mon Dec 17 19:11:00 UTC 2018


Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
---
 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




More information about the Libosinfo mailing list