[gnome-software/wip/hughsie/no-global-cache: 5/8] Do not use the global cache directly in the self tests



commit 8a77f44a6e10e05f4dbdb4750fd5399de04548aa
Author: Richard Hughes <richard hughsie com>
Date:   Thu Feb 22 16:01:06 2018 +0000

    Do not use the global cache directly in the self tests

 lib/gs-plugin-loader.c         | 15 ---------------
 lib/gs-plugin-loader.h         |  1 -
 plugins/flatpak/gs-self-test.c |  7 +++----
 3 files changed, 3 insertions(+), 20 deletions(-)
---
diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c
index 7150207d..8f767b53 100644
--- a/lib/gs-plugin-loader.c
+++ b/lib/gs-plugin-loader.c
@@ -3777,19 +3777,4 @@ gs_plugin_loader_set_max_parallel_ops (GsPluginLoader *plugin_loader,
                           error->message);
 }
 
-/*
- * gs_plugin_loader_get_global_cache:
- * @plugin_loader: a #GsPluginLoader
- *
- * Returns the global cache.
- *
- * Returns: (transfer none): a #GsAppList
- **/
-GsAppList *
-gs_plugin_loader_get_global_cache (GsPluginLoader *plugin_loader)
-{
-       GsPluginLoaderPrivate *priv = gs_plugin_loader_get_instance_private (plugin_loader);
-       return priv->global_cache;
-}
-
 /* vim: set noexpandtab: */
diff --git a/lib/gs-plugin-loader.h b/lib/gs-plugin-loader.h
index 67b6ff8c..6c4661c5 100644
--- a/lib/gs-plugin-loader.h
+++ b/lib/gs-plugin-loader.h
@@ -111,7 +111,6 @@ GsPlugin    *gs_plugin_loader_find_plugin           (GsPluginLoader *plugin_loader,
                                                         const gchar    *plugin_name);
 void            gs_plugin_loader_set_max_parallel_ops  (GsPluginLoader *plugin_loader,
                                                         guint           num_ops);
-GsAppList      *gs_plugin_loader_get_global_cache      (GsPluginLoader *plugin_loader);
 
 
 G_END_DECLS
diff --git a/plugins/flatpak/gs-self-test.c b/plugins/flatpak/gs-self-test.c
index 6f4a88b0..14239d79 100644
--- a/plugins/flatpak/gs-self-test.c
+++ b/plugins/flatpak/gs-self-test.c
@@ -1489,7 +1489,6 @@ gs_plugins_flatpak_runtime_extension_func (GsPluginLoader *plugin_loader)
 {
        GsApp *app;
        GsApp *runtime;
-       GsApp *extension;
        GsApp *app_tmp;
        gboolean got_progress_installing = FALSE;
        gboolean ret;
@@ -1504,11 +1503,11 @@ gs_plugins_flatpak_runtime_extension_func (GsPluginLoader *plugin_loader)
        g_autofree gchar *repodir2_fn = NULL;
        g_autoptr(GError) error = NULL;
        g_autoptr(GsApp) app_source = NULL;
+       g_autoptr(GsApp) extension = NULL;
        g_autoptr(GsAppList) list = NULL;
        g_autoptr(GsAppList) list_updates = NULL;
        g_autoptr(GsPluginJob) plugin_job = NULL;
        g_autoptr(GMainLoop) loop = g_main_loop_new (NULL, FALSE);
-       GsAppList *global_cache = NULL;
 
        /* drop all caches */
        gs_plugin_loader_setup_again (plugin_loader);
@@ -1589,8 +1588,8 @@ gs_plugins_flatpak_runtime_extension_func (GsPluginLoader *plugin_loader)
        g_assert_cmpstr (gs_app_get_version (app), ==, "1.2.3");
 
        /* check if the extension was installed */
-       global_cache = gs_plugin_loader_get_global_cache (plugin_loader);
-       extension = gs_app_list_lookup (global_cache, 
"user/flatpak/*/runtime/org.test.Chiron.Extension/master");
+       extension = gs_plugin_loader_app_create (plugin_loader,
+                       "user/flatpak/*/runtime/org.test.Chiron.Extension/master");
        g_assert_nonnull (extension);
        g_assert_cmpint (gs_app_get_state (extension), ==, AS_APP_STATE_INSTALLED);
 


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