[gnome-software/wip/improve-tests: 473/475] flatpak: Remove runtime and remote after their use in a unit test



commit 62c7a80d06f54452e9b65b938b2d312b7bb3ae54
Author: Joaquim Rocha <jrocha endlessm com>
Date:   Mon May 14 14:31:41 2018 +0200

    flatpak: Remove runtime and remote after their use in a unit test
    
    In the runtime extensions test, the used runtime and remote were not
    getting removed after being used. This could cause some issues in tests
    performed after this one (e.g. trying to install a remote when there's
    one that exists already).

 plugins/flatpak/gs-self-test.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
---
diff --git a/plugins/flatpak/gs-self-test.c b/plugins/flatpak/gs-self-test.c
index d3757f6c..d3fdee02 100644
--- a/plugins/flatpak/gs-self-test.c
+++ b/plugins/flatpak/gs-self-test.c
@@ -1702,6 +1702,31 @@ gs_plugins_flatpak_runtime_extension_func (GsPluginLoader *plugin_loader)
 
        /* verify that the extension has been removed by the app's removal */
        g_assert_false (gs_app_is_installed (extension));
+
+       /* remove the runtime */
+       app_tmp = gs_app_get_runtime (app);
+       g_assert_nonnull (app_tmp);
+
+       g_object_unref (plugin_job);
+       plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_REMOVE,
+                                        "app", app_tmp,
+                                        NULL);
+       ret = gs_plugin_loader_job_action (plugin_loader, plugin_job, NULL, &error);
+       gs_test_flush_main_context ();
+       g_assert_no_error (error);
+       g_assert (ret);
+       g_assert_cmpint (gs_app_get_state (app_tmp), ==, AS_APP_STATE_AVAILABLE);
+
+       /* remove the remote */
+       g_object_unref (plugin_job);
+       plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_REMOVE,
+                                        "app", app_source,
+                                        NULL);
+       ret = gs_plugin_loader_job_action (plugin_loader, plugin_job, NULL, &error);
+       gs_test_flush_main_context ();
+       g_assert_no_error (error);
+       g_assert (ret);
+       g_assert_cmpint (gs_app_get_state (app_source), ==, AS_APP_STATE_AVAILABLE);
 }
 
 int


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