[libosinfo PATCH v3 2/5] test-install-script: Cover _(get|set)_preferred_injection_method()

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

 



Signed-off-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx>
---
 .../libosinfo-test-install-script.xml         |  5 ++++
 tests/test-install-script.c                   | 23 +++++++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/tests/dbdata/install-script/example.com/libosinfo-test-install-script.xml b/tests/dbdata/install-script/example.com/libosinfo-test-install-script.xml
index e3c05b7..f03da75 100644
--- a/tests/dbdata/install-script/example.com/libosinfo-test-install-script.xml
+++ b/tests/dbdata/install-script/example.com/libosinfo-test-install-script.xml
@@ -8,6 +8,11 @@
       <param name="l10n-language" policy="optional" value-map="http://example.com/libosinfo/test-datamap2"/>
       <param name="l10n-timezone" policy="optional"/>
     </config>
+    <injection-method>cdrom</injection-method>
+    <injection-method>disk</injection-method>
+    <injection-method>floppy</injection-method>
+    <injection-method>initrd</injection-method>
+
     <template>
       <xsl:stylesheet
         xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
diff --git a/tests/test-install-script.c b/tests/test-install-script.c
index 4935c32..4caf5fe 100644
--- a/tests/test-install-script.c
+++ b/tests/test-install-script.c
@@ -298,6 +298,28 @@ test_script_datamap(void)
     g_main_loop_unref(loop);
 }
 
+static void
+test_preferred_injection_method(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_preferred_injection_method(script) == OSINFO_INSTALL_SCRIPT_INJECTION_METHOD_DISK);
+    osinfo_install_script_set_preferred_injection_method(script, OSINFO_INSTALL_SCRIPT_INJECTION_METHOD_INITRD);
+    g_assert_true(osinfo_install_script_get_preferred_injection_method(script) == OSINFO_INSTALL_SCRIPT_INJECTION_METHOD_INITRD);
+
+    g_object_unref(db);
+}
 
 int
 main(int argc, char *argv[])
@@ -307,6 +329,7 @@ main(int argc, char *argv[])
     g_test_add_func("/install-script/script_file", test_script_file);
     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);
 
     /* 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