[gnome-software/gnome-3-20] Fix the self tests and add greatly to them



commit c708b4943eed87062f74d637d6d49bea28a48369
Author: Richard Hughes <richard hughsie com>
Date:   Sun Apr 17 07:52:22 2016 +0100

    Fix the self tests and add greatly to them

 src/Makefile.am                    |    1 +
 src/gs-application.c               |    4 +-
 src/gs-cmd.c                       |    4 +-
 src/gs-plugin-loader.c             |   89 ++++---
 src/gs-plugin-loader.h             |    6 +-
 src/gs-self-test.c                 |  476 +++++++++++++++++++++---------------
 src/plugins/gs-plugin-appstream.c  |   32 ++-
 src/plugins/gs-plugin-dummy.c      |  145 +++++++-----
 src/plugins/gs-plugin-provenance.c |   21 ++-
 9 files changed, 460 insertions(+), 318 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 642dfd5..020d22a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -17,6 +17,7 @@ AM_CPPFLAGS =                                         \
        -DDATADIR=\"$(datadir)\"                        \
        -DVERSION="\"$(VERSION)\""                      \
        -DLOCALEDIR=\""$(localedir)"\"                  \
+       -DTESTDATADIR=\""$(top_srcdir)/data"\"          \
        -DGS_DATA=\"$(pkgdatadir)\"
 
 @INTLTOOL_DESKTOP_RULE@
diff --git a/src/gs-application.c b/src/gs-application.c
index bffb138..02270fa 100644
--- a/src/gs-application.c
+++ b/src/gs-application.c
@@ -1,7 +1,7 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
  *
  * Copyright (C) 2013 Matthias Clasen <mclasen redhat com>
- * Copyright (C) 2013 Richard Hughes <richard hughsie com>
+ * Copyright (C) 2013-2016 Richard Hughes <richard hughsie com>
  *
  * Licensed under the GNU General Public License Version 2
  *
@@ -203,7 +203,7 @@ gs_application_initialize_plugins (GsApplication *app)
 
        app->plugin_loader = gs_plugin_loader_new ();
        gs_plugin_loader_set_location (app->plugin_loader, NULL);
-       if (!gs_plugin_loader_setup (app->plugin_loader, &error)) {
+       if (!gs_plugin_loader_setup (app->plugin_loader, NULL, &error)) {
                g_warning ("Failed to setup plugins: %s", error->message);
                exit (1);
        }
diff --git a/src/gs-cmd.c b/src/gs-cmd.c
index d1d3af8..acfd509 100644
--- a/src/gs-cmd.c
+++ b/src/gs-cmd.c
@@ -1,6 +1,6 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
  *
- * Copyright (C) 2013-2014 Richard Hughes <richard hughsie com>
+ * Copyright (C) 2013-2016 Richard Hughes <richard hughsie com>
  *
  * Licensed under the GNU General Public License Version 2
  *
@@ -260,7 +260,7 @@ main (int argc, char **argv)
        /* load plugins */
        plugin_loader = gs_plugin_loader_new ();
        gs_plugin_loader_set_location (plugin_loader, "./plugins/.libs");
-       ret = gs_plugin_loader_setup (plugin_loader, &error);
+       ret = gs_plugin_loader_setup (plugin_loader, NULL, &error);
        if (!ret) {
                g_print ("Failed to setup plugins: %s\n", error->message);
                goto out;
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index 4add2f5..8d63855 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -2815,27 +2815,36 @@ gs_plugin_loader_run (GsPluginLoader *plugin_loader, const gchar *function_name)
 }
 
 /**
- * gs_plugin_loader_set_enabled:
+ * gs_plugin_loader_find_plugin:
  */
-gboolean
-gs_plugin_loader_set_enabled (GsPluginLoader *plugin_loader,
-                             const gchar *plugin_name,
-                             gboolean enabled)
+static GsPlugin *
+gs_plugin_loader_find_plugin (GsPluginLoader *plugin_loader,
+                             const gchar *plugin_name)
 {
        GsPluginLoaderPrivate *priv = gs_plugin_loader_get_instance_private (plugin_loader);
-       gboolean ret = FALSE;
        GsPlugin *plugin;
        guint i;
 
        for (i = 0; i < priv->plugins->len; i++) {
                plugin = g_ptr_array_index (priv->plugins, i);
-               if (g_strcmp0 (plugin->name, plugin_name) == 0) {
-                       plugin->enabled = enabled;
-                       ret = TRUE;
-                       break;
-               }
+               if (g_strcmp0 (plugin->name, plugin_name) == 0)
+                       return plugin;
        }
-       return ret;
+       return NULL;
+}
+
+/**
+ * gs_plugin_loader_get_enabled:
+ */
+gboolean
+gs_plugin_loader_get_enabled (GsPluginLoader *plugin_loader,
+                             const gchar *plugin_name)
+{
+       GsPlugin *plugin;
+       plugin = gs_plugin_loader_find_plugin (plugin_loader, plugin_name);
+       if (plugin == NULL)
+               return FALSE;
+       return plugin->enabled;
 }
 
 /**
@@ -3036,29 +3045,12 @@ gs_plugin_loader_plugin_sort_fn (gconstpointer a, gconstpointer b)
 }
 
 /**
- * gs_plugin_loader_find_plugin:
- */
-static GsPlugin *
-gs_plugin_loader_find_plugin (GsPluginLoader *plugin_loader,
-                             const gchar *plugin_name)
-{
-       GsPluginLoaderPrivate *priv = gs_plugin_loader_get_instance_private (plugin_loader);
-       GsPlugin *plugin;
-       guint i;
-
-       for (i = 0; i < priv->plugins->len; i++) {
-               plugin = g_ptr_array_index (priv->plugins, i);
-               if (g_strcmp0 (plugin->name, plugin_name) == 0)
-                       return plugin;
-       }
-       return NULL;
-}
-
-/**
  * gs_plugin_loader_setup:
  */
 gboolean
-gs_plugin_loader_setup (GsPluginLoader *plugin_loader, GError **error)
+gs_plugin_loader_setup (GsPluginLoader *plugin_loader,
+                       gchar **whitelist,
+                       GError **error)
 {
        GsPluginLoaderPrivate *priv = gs_plugin_loader_get_instance_private (plugin_loader);
        const gchar *filename_tmp;
@@ -3095,6 +3087,17 @@ gs_plugin_loader_setup (GsPluginLoader *plugin_loader, GError **error)
                gs_plugin_loader_open_plugin (plugin_loader, filename_plugin);
        } while (TRUE);
 
+       /* optional whitelist */
+       if (whitelist != NULL) {
+               for (i = 0; i < priv->plugins->len; i++) {
+                       plugin = g_ptr_array_index (priv->plugins, i);
+                       if (!plugin->enabled)
+                               continue;
+                       plugin->enabled = g_strv_contains ((const gchar * const *) whitelist,
+                                                          plugin->name);
+               }
+       }
+
        /* order by deps */
        do {
                changes = FALSE;
@@ -3342,7 +3345,6 @@ gs_plugin_loader_init (GsPluginLoader *plugin_loader)
 {
        GsPluginLoaderPrivate *priv = gs_plugin_loader_get_instance_private (plugin_loader);
        const gchar *tmp;
-       gchar *match;
        gchar **projects;
        guint i;
 
@@ -3360,13 +3362,20 @@ gs_plugin_loader_init (GsPluginLoader *plugin_loader)
                                             SOUP_TYPE_CONTENT_DECODER);
 
        /* get the locale without the various UTF-8 suffixes */
-       priv->locale = g_strdup (setlocale (LC_MESSAGES, NULL));
-       match = g_strstr_len (priv->locale, -1, ".UTF-8");
-       if (match != NULL)
-               *match = '\0';
-       match = g_strstr_len (priv->locale, -1, ".utf8");
-       if (match != NULL)
-               *match = '\0';
+       tmp = g_getenv ("GS_SELF_TEST_LOCALE");
+       if (tmp != NULL) {
+               g_debug ("using self test locale of %s", tmp);
+               priv->locale = g_strdup (tmp);
+       } else {
+               gchar *match;
+               priv->locale = g_strdup (setlocale (LC_MESSAGES, NULL));
+               match = g_strstr_len (priv->locale, -1, ".UTF-8");
+               if (match != NULL)
+                       *match = '\0';
+               match = g_strstr_len (priv->locale, -1, ".utf8");
+               if (match != NULL)
+                       *match = '\0';
+       }
 
        g_mutex_init (&priv->pending_apps_mutex);
 
diff --git a/src/gs-plugin-loader.h b/src/gs-plugin-loader.h
index f1a2d8c..af4f4ea 100644
--- a/src/gs-plugin-loader.h
+++ b/src/gs-plugin-loader.h
@@ -189,11 +189,11 @@ gboolean   gs_plugin_loader_offline_update_finish (GsPluginLoader *plugin_loader,
                                                         GAsyncResult   *res,
                                                         GError         **error);
 gboolean        gs_plugin_loader_setup                 (GsPluginLoader *plugin_loader,
+                                                        gchar          **whitelist,
                                                         GError         **error);
 void            gs_plugin_loader_dump_state            (GsPluginLoader *plugin_loader);
-gboolean        gs_plugin_loader_set_enabled           (GsPluginLoader *plugin_loader,
-                                                        const gchar    *plugin_name,
-                                                        gboolean        enabled);
+gboolean        gs_plugin_loader_get_enabled           (GsPluginLoader *plugin_loader,
+                                                        const gchar    *plugin_name);
 void            gs_plugin_loader_set_location          (GsPluginLoader *plugin_loader,
                                                         const gchar    *location);
 gint            gs_plugin_loader_get_scale             (GsPluginLoader *plugin_loader);
diff --git a/src/gs-self-test.c b/src/gs-self-test.c
index 10e7515..d058e78 100644
--- a/src/gs-self-test.c
+++ b/src/gs-self-test.c
@@ -21,10 +21,8 @@
 
 #include "config.h"
 
-#include <glib.h>
 #include <glib-object.h>
-#include <gtk/gtk.h>
-#include <glib/gstdio.h>
+#include <stdlib.h>
 
 #include "gs-app.h"
 #include "gs-plugin.h"
@@ -32,6 +30,22 @@
 #include "gs-plugin-loader-sync.h"
 #include "gs-utils.h"
 
+/**
+ * gs_test_get_filename:
+ **/
+static gchar *
+gs_test_get_filename (const gchar *filename)
+{
+       gchar *tmp;
+       char full_tmp[PATH_MAX];
+       g_autofree gchar *path = NULL;
+       path = g_build_filename (TESTDATADIR, filename, NULL);
+       tmp = realpath (path, full_tmp);
+       if (tmp == NULL)
+               return NULL;
+       return g_strdup (full_tmp);
+}
+
 static gboolean
 gs_plugin_list_filter_cb (GsApp *app, gpointer user_data)
 {
@@ -143,267 +157,335 @@ gs_plugin_loader_status_changed_cb (GsPluginLoader *plugin_loader,
        _status_changed_cnt++;
 }
 
+
 static void
-gs_plugin_loader_func (void)
+gs_plugin_loader_refine_func (GsPluginLoader *plugin_loader)
 {
        gboolean ret;
-       GError *error = NULL;
-       GList *list;
-       GList *l;
-       GsApp *app;
-       g_autoptr(GsPluginLoader) loader = NULL;
-
-       /* not avaiable in make distcheck */
-       if (!g_file_test (GS_MODULESETDIR, G_FILE_TEST_EXISTS))
-               return;
-
-       loader = gs_plugin_loader_new ();
-       g_assert (GS_IS_PLUGIN_LOADER (loader));
-       g_signal_connect (loader, "status-changed",
-                         G_CALLBACK (gs_plugin_loader_status_changed_cb), NULL);
+       g_autoptr(GsApp) app = NULL;
+       g_autoptr(GError) error = NULL;
 
-       /* load the plugins */
-       gs_plugin_loader_set_location (loader, "./plugins/.libs");
-       ret = gs_plugin_loader_setup (loader, &error);
+       /* get the extra bits */
+       app = gs_app_new ("chiron.desktop");
+       gs_app_set_management_plugin (app, "dummy");
+       ret = gs_plugin_loader_app_refine (plugin_loader, app,
+                                          GS_PLUGIN_REFINE_FLAGS_REQUIRE_DESCRIPTION |
+                                          GS_PLUGIN_REFINE_FLAGS_REQUIRE_LICENSE |
+                                          GS_PLUGIN_REFINE_FLAGS_REQUIRE_URL,
+                                          NULL,
+                                          &error);
        g_assert_no_error (error);
        g_assert (ret);
 
-       /* enable some that will give us predictable results */
-       ret = gs_plugin_loader_set_enabled (loader, "dummy", TRUE);
-       g_assert (ret);
-       ret = gs_plugin_loader_set_enabled (loader, "hardcoded-kind", TRUE);
-       g_assert (ret);
-       ret = gs_plugin_loader_set_enabled (loader, "moduleset", TRUE);
-       g_assert (ret);
-       ret = gs_plugin_loader_set_enabled (loader, "hardcoded-ratings", TRUE);
-       g_assert (ret);
-       ret = gs_plugin_loader_set_enabled (loader, "datadir-filename", TRUE);
-       g_assert (ret);
-       ret = gs_plugin_loader_set_enabled (loader, "datadir-apps", TRUE);
-       g_assert (ret);
-       ret = gs_plugin_loader_set_enabled (loader, "notgoingtoexist", TRUE);
-       g_assert (!ret);
+       g_assert_cmpstr (gs_app_get_license (app), ==,
+                        "<a href=\"http://spdx.org/licenses/GPL-2.0+\";>GPL-2.0+</a>");
+       g_assert_cmpstr (gs_app_get_description (app), !=, NULL);
+       g_assert_cmpstr (gs_app_get_url (app, AS_URL_KIND_HOMEPAGE), ==, "http://www.test.org/";);
+}
 
-       list = gs_plugin_loader_get_popular (loader, GS_PLUGIN_REFINE_FLAGS_DEFAULT, NULL, &error);
+static void
+gs_plugin_loader_updates_func (GsPluginLoader *plugin_loader)
+{
+       GsApp *app;
+       g_autoptr(GError) error = NULL;
+       g_autoptr(GsAppList) list = NULL;
+
+       /* get the updates list */
+       list = gs_plugin_loader_get_updates (plugin_loader,
+                                            GS_PLUGIN_REFINE_FLAGS_DEFAULT,
+                                            NULL,
+                                            &error);
        g_assert_no_error (error);
        g_assert (list != NULL);
-       g_assert_cmpint (_status_changed_cnt, ==, 1);
-       g_assert_cmpint (g_list_length (list), ==, 6);
-       app = g_list_nth_data (list, 0);
-       g_assert_cmpstr (gs_app_get_id (app), ==, "gnome-boxes");
-       g_assert_cmpstr (gs_app_get_name (app), ==, "Boxes");
-
-       app = g_list_nth_data (list, 1);
-       g_assert_cmpstr (gs_app_get_id (app), ==, "gedit");
-       g_assert_cmpstr (gs_app_get_summary (app), ==, "Edit text files");
 
-       gs_plugin_list_free (list);
-
-       /* get updates */
-       _status_changed_cnt = 0;
-       list = gs_plugin_loader_get_updates (loader, GS_PLUGIN_REFINE_FLAGS_DEFAULT, NULL, &error);
-       g_assert_no_error (error);
-       g_assert (list != NULL);
-       g_assert_cmpint (_status_changed_cnt, >=, 1);
+       /* make sure there are two entries */
        g_assert_cmpint (g_list_length (list), ==, 2);
        app = g_list_nth_data (list, 0);
-       g_assert_cmpstr (gs_app_get_id (app), ==, 
"os-update:gnome-boxes-libs;0.0.1;i386;updates-testing,libvirt-glib-devel;0.0.1;noarch;fedora");
-       g_assert_cmpstr (gs_app_get_name (app), ==, "OS Updates");
-//     g_assert_cmpstr (gs_app_get_summary (app), ==, "Includes performance, stability and security 
improvements for all users\nDo not segfault when using newer versons of libvirt.\nFix several memory leaks.");
-       g_assert_cmpint (gs_app_get_kind (app), ==, AS_APP_KIND_OS_UPDATE);
-
-       app = g_list_nth_data (list, 1);
-       g_assert_cmpstr (gs_app_get_id (app), ==, "gnome-boxes");
-       g_assert_cmpstr (gs_app_get_name (app), ==, "Boxes");
-       g_assert_cmpstr (gs_app_get_summary (app), ==, "Do not segfault when using newer versons of 
libvirt.");
+       g_assert_cmpstr (gs_app_get_id (app), ==, "chiron.desktop");
        g_assert_cmpint (gs_app_get_kind (app), ==, AS_APP_KIND_DESKTOP);
-       gs_plugin_list_free (list);
+       g_assert_cmpint (gs_app_get_state (app), ==, AS_APP_STATE_UPDATABLE_LIVE);
+       g_assert_cmpstr (gs_app_get_update_details (app), ==, "Do not crash when using libvirt.");
+       g_assert_cmpint (gs_app_get_update_urgency (app), ==, AS_URGENCY_KIND_HIGH);
 
-       /* test packagekit */
-       gs_plugin_loader_set_enabled (loader, "dummy", FALSE);
-       ret = gs_plugin_loader_set_enabled (loader, "packagekit", TRUE);
-       g_assert (ret);
-       ret = gs_plugin_loader_set_enabled (loader, "desktopdb", TRUE);
-       g_assert (ret);
-       ret = gs_plugin_loader_set_enabled (loader, "datadir-apps", TRUE);
-       g_assert (ret);
+       /* get the virtual non-apps OS update */
+       app = g_list_nth_data (list, 1);
+       g_assert_cmpstr (gs_app_get_id (app), ==, "os-update.virtual");
+       g_assert_cmpstr (gs_app_get_name (app), ==, "OS Updates");
+       g_assert_cmpstr (gs_app_get_summary (app), ==, "Includes performance, stability and security 
improvements.");
+       g_assert_cmpint (gs_app_get_kind (app), ==, AS_APP_KIND_OS_UPDATE);
+       g_assert_cmpint (gs_app_get_state (app), ==, AS_APP_STATE_UPDATABLE);
+       g_assert_cmpint (gs_app_get_related(app)->len, ==, 2);
+}
 
-       list = gs_plugin_loader_get_installed (loader, GS_PLUGIN_REFINE_FLAGS_DEFAULT, NULL, &error);
+static void
+gs_plugin_loader_distro_upgrades_func (GsPluginLoader *plugin_loader)
+{
+       GsApp *app;
+       gboolean ret;
+       g_autoptr(GError) error = NULL;
+       g_autoptr(GsAppList) list = NULL;
+
+       /* get the updates list */
+       list = gs_plugin_loader_get_distro_upgrades (plugin_loader,
+                                                    GS_PLUGIN_REFINE_FLAGS_DEFAULT,
+                                                    NULL,
+                                                    &error);
        g_assert_no_error (error);
        g_assert (list != NULL);
-       g_assert_cmpint (g_list_length (list), >, 50);
-
-       /* find a specific app */
-       for (l = list; l != NULL; l = l->next) {
-               app = GS_APP (l->data);
-               if (g_strcmp0 (gs_app_get_id (app), "gnome-screenshot") == 0)
-                       break;
-       }
-       g_assert_cmpstr (gs_app_get_id (app), ==, "gnome-screenshot");
-       g_assert_cmpstr (gs_app_get_name (app), ==, "Screenshot");
-       g_assert_cmpstr (gs_app_get_summary (app), ==, "Save images of your screen or individual windows");
-       g_assert_cmpint (gs_app_get_state (app), ==, AS_APP_STATE_INSTALLED);
-       g_assert_cmpint (gs_app_get_kind (app), ==, AS_APP_KIND_DESKTOP);
-       g_assert (gs_app_has_quirk (app, AS_APP_QUIRK_COMPULSORY));
-       g_assert (gs_app_get_pixbuf (app) != NULL);
-       gs_plugin_list_free (list);
 
-       /* do this again, which should be much faster */
-       list = gs_plugin_loader_get_installed (loader, GS_PLUGIN_REFINE_FLAGS_DEFAULT, NULL, &error);
-       g_assert_no_error (error);
-       g_assert (list != NULL);
-       g_assert_cmpint (g_list_length (list), >, 50);
-       gs_plugin_list_free (list);
+       /* make sure there is one entry */
+       g_assert_cmpint (g_list_length (list), ==, 1);
+       app = GS_APP (list->data);
+       g_assert_cmpstr (gs_app_get_id (app), ==, "org.fedoraproject.release-24.upgrade");
+       g_assert_cmpint (gs_app_get_kind (app), ==, AS_APP_KIND_OS_UPGRADE);
+       g_assert_cmpint (gs_app_get_state (app), ==, AS_APP_STATE_AVAILABLE);
 
-       /* set a rating */
-       gs_plugin_loader_set_enabled (loader, "packagekit", FALSE);
-       gs_plugin_loader_set_enabled (loader, "desktopdb", FALSE);
-       gs_plugin_loader_set_enabled (loader, "datadir-apps", FALSE);
-       ret = gs_plugin_loader_set_enabled (loader, "local-ratings", TRUE);
-       g_assert (ret);
+       /* this should be set with a higher priority by AppStream */
+       g_assert_cmpstr (gs_app_get_summary (app), ==, "Release specific tagline");
 
-       /* create a dummy value */
-       app = gs_app_new ("self-test");
-       gs_app_set_rating (app, 35);
-       ret = gs_plugin_loader_app_action (loader,
+       /* download the update */
+       ret = gs_plugin_loader_app_action (plugin_loader,
                                           app,
-                                          GS_PLUGIN_LOADER_ACTION_SET_RATING,
+                                          GS_PLUGIN_LOADER_ACTION_UPGRADE_DOWNLOAD,
                                           NULL,
                                           &error);
        g_assert_no_error (error);
        g_assert (ret);
+       g_assert_cmpint (gs_app_get_state (app), ==, AS_APP_STATE_UPDATABLE);
 
-       /* get the saved value */
-       gs_app_set_rating (app, -1);
-       ret = gs_plugin_loader_app_refine (loader,
+       /* trigger the update */
+       ret = gs_plugin_loader_app_action (plugin_loader,
                                           app,
-                                          GS_PLUGIN_REFINE_FLAGS_DEFAULT,
+                                          GS_PLUGIN_LOADER_ACTION_UPGRADE_TRIGGER,
                                           NULL,
                                           &error);
        g_assert_no_error (error);
        g_assert (ret);
-       g_assert_cmpint (gs_app_get_rating (app), ==, 35);
-       g_object_unref (app);
+       g_assert_cmpint (gs_app_get_state (app), ==, AS_APP_STATE_UPDATABLE);
 }
 
 static void
-gs_plugin_loader_refine_func (void)
+gs_plugin_loader_installed_func (GsPluginLoader *plugin_loader)
 {
-       GError *error = NULL;
-       const gchar *url;
-       gboolean ret;
-       g_autoptr(GsApp) app = NULL;
-       g_autoptr(GsPluginLoader) loader = NULL;
-
-       /* not avaiable in make distcheck */
-       if (!g_file_test (GS_MODULESETDIR, G_FILE_TEST_EXISTS))
-               return;
-
-       /* load the plugins */
-       loader = gs_plugin_loader_new ();
-       gs_plugin_loader_set_location (loader, "./plugins/.libs");
-       ret = gs_plugin_loader_setup (loader, &error);
+       GsApp *app;
+       GsApp *addon;
+       GPtrArray *addons;
+       guint64 kudos;
+       g_autofree gchar *menu_path = NULL;
+       g_autoptr(GError) error = NULL;
+       g_autoptr(GsAppList) list = NULL;
+
+       /* get installed packages */
+       list = gs_plugin_loader_get_installed (plugin_loader,
+                                              GS_PLUGIN_REFINE_FLAGS_REQUIRE_LICENSE |
+                                              GS_PLUGIN_REFINE_FLAGS_REQUIRE_MENU_PATH |
+                                              GS_PLUGIN_REFINE_FLAGS_REQUIRE_PROVENANCE,
+                                              NULL,
+                                              &error);
        g_assert_no_error (error);
-       g_assert (ret);
+       g_assert (list != NULL);
 
-       ret = gs_plugin_loader_set_enabled (loader, "dummy", TRUE);
-       g_assert (ret);
+       /* make sure there is one entry */
+       g_assert_cmpint (g_list_length (list), ==, 1);
+       app = GS_APP (list->data);
+       g_assert_cmpstr (gs_app_get_id (app), ==, "zeus.desktop");
+       g_assert_cmpint (gs_app_get_kind (app), ==, AS_APP_KIND_DESKTOP);
+       g_assert_cmpint (gs_app_get_state (app), ==, AS_APP_STATE_INSTALLED);
+       g_assert_cmpstr (gs_app_get_name (app), ==, "Zeus");
+       g_assert_cmpstr (gs_app_get_source_default (app), ==, "zeus");
+       g_assert (gs_app_get_pixbuf (app) != NULL);
 
-       /* get the extra bits */
-       app = gs_app_new ("gnome-boxes");
-       gs_app_add_source (app, "gnome-boxes");
-       ret = gs_plugin_loader_app_refine (loader, app,
-                                          GS_PLUGIN_REFINE_FLAGS_DEFAULT |
-                                          GS_PLUGIN_REFINE_FLAGS_REQUIRE_DESCRIPTION |
-                                          GS_PLUGIN_REFINE_FLAGS_REQUIRE_LICENSE |
-                                          GS_PLUGIN_REFINE_FLAGS_REQUIRE_URL,
-                                          NULL,
-                                          &error);
+       /* check various bitfields */
+       g_assert (gs_app_has_quirk (app, AS_APP_QUIRK_PROVENANCE));
+       g_assert (gs_app_get_license_is_free (app));
+
+       /* check kudos */
+       kudos = gs_app_get_kudos (app);
+       g_assert (kudos & GS_APP_KUDO_MY_LANGUAGE);
+
+       /* check categories */
+       g_assert (gs_app_has_category (app, "Audio"));
+       g_assert (gs_app_has_category (app, "Player"));
+       g_assert (gs_app_has_category (app, "AudioVideo"));
+       g_assert (!gs_app_has_category (app, "ImageProcessing"));
+       g_assert (gs_app_get_menu_path (app) != NULL);
+       menu_path = g_strjoinv ("->", gs_app_get_menu_path (app));
+       g_assert_cmpstr (menu_path, ==, "Audio->Players");
+
+       /* check addon */
+       addons = gs_app_get_addons (app);
+       g_assert_cmpint (addons->len, ==, 1);
+       addon = g_ptr_array_index (addons, 0);
+       g_assert_cmpstr (gs_app_get_id (addon), ==, "zeus-spell.addon");
+       g_assert_cmpint (gs_app_get_kind (addon), ==, AS_APP_KIND_ADDON);
+       g_assert_cmpint (gs_app_get_state (addon), ==, AS_APP_STATE_UNKNOWN);
+       g_assert_cmpstr (gs_app_get_name (addon), ==, "Spell Check");
+       g_assert_cmpstr (gs_app_get_source_default (addon), ==, "zeus-spell");
+       g_assert (gs_app_get_pixbuf (addon) == NULL);
+}
+
+static void
+gs_plugin_loader_search_func (GsPluginLoader *plugin_loader)
+{
+       GsApp *app;
+       g_autofree gchar *menu_path = NULL;
+       g_autoptr(GError) error = NULL;
+       g_autoptr(GsAppList) list = NULL;
+
+       /* get search result based on addon keyword */
+       list = gs_plugin_loader_search (plugin_loader,
+                                       "spell",
+                                       GS_PLUGIN_REFINE_FLAGS_DEFAULT,
+                                       NULL,
+                                       &error);
        g_assert_no_error (error);
-       g_assert (ret);
+       g_assert (list != NULL);
 
-       g_assert_cmpstr (gs_app_get_license (app), ==,
-                        "<a href=\"http://spdx.org/licenses/GPL-2.0+\";>GPL-2.0+</a>");
-       g_assert_cmpstr (gs_app_get_description (app), !=, NULL);
-       url = gs_app_get_url (app, AS_URL_KIND_HOMEPAGE);
-       g_assert_cmpstr (url, ==, "http://www.gimp.org/";);
+       /* make sure there is one entry, the parent app */
+       g_assert_cmpint (g_list_length (list), ==, 1);
+       app = GS_APP (list->data);
+       g_assert_cmpstr (gs_app_get_id (app), ==, "zeus.desktop");
+       g_assert_cmpint (gs_app_get_kind (app), ==, AS_APP_KIND_DESKTOP);
 }
 
 static void
-gs_plugin_loader_webapps_func (void)
+gs_plugin_loader_webapps_func (GsPluginLoader *plugin_loader)
 {
        gboolean ret;
-       GError *error = NULL;
-       g_autofree gchar *path = NULL;
+       g_autoptr(GError) error = NULL;
        g_autoptr(GsApp) app = NULL;
-       g_autoptr(GsPluginLoader) loader = NULL;
-
-       /* not avaiable in make distcheck */
-       if (!g_file_test (GS_MODULESETDIR, G_FILE_TEST_EXISTS))
-               return;
 
-       /* load the plugins */
-       loader = gs_plugin_loader_new ();
-       gs_plugin_loader_set_location (loader, "./plugins/.libs");
-       ret = gs_plugin_loader_setup (loader, &error);
-       g_assert_no_error (error);
-       g_assert (ret);
-
-       /* save shitty file */
-       path = g_build_filename (g_get_user_data_dir (),
-                                "app-info",
-                                "xmls",
-                                "test.xml",
-                                NULL);
-       ret = gs_mkdir_parent (path, &error);
-       g_assert_no_error (error);
-       g_assert (ret);
-       ret = g_file_set_contents (path,
-                                  "<?xml version=\"1.0\"?>\n"
-                                  "<applications version=\"0.1\">\n"
-                                  "  <application>\n"
-                                  "    <id type=\"webapp\">epiphany-test.desktop</id>\n"
-                                  "    <name>test</name>\n"
-                                  "    <icon type=\"remote\">http://www.test.com/test.png</icon>\n"
-                                  "  </application>\n"
-                                  "</applications>\n",
-                                  -1,
-                                  &error);
-       g_assert_no_error (error);
-       g_assert (ret);
-
-       /* load a webapp with a failing icon */
-       app = gs_app_new ("epiphany-test");
-       ret = gs_plugin_loader_app_refine (loader, app,
+       /* a webapp with a local icon */
+       app = gs_app_new ("arachne.desktop");
+       gs_app_set_kind (app, AS_APP_KIND_WEB_APP);
+       ret = gs_plugin_loader_app_refine (plugin_loader, app,
                                           GS_PLUGIN_REFINE_FLAGS_DEFAULT,
                                           NULL,
                                           &error);
        g_assert_no_error (error);
        g_assert (ret);
-       g_assert_cmpint (gs_app_get_state (app), ==, AS_APP_STATE_UNAVAILABLE);
-
-       g_unlink (path);
+       g_assert_cmpint (gs_app_get_state (app), ==, AS_APP_STATE_AVAILABLE);
+       g_assert (gs_app_get_pixbuf (app) != NULL);
 }
 
 int
 main (int argc, char **argv)
 {
-       gtk_init (&argc, &argv);
+       gboolean ret;
+       g_autofree gchar *fn = NULL;
+       g_autofree gchar *xml = NULL;
+       g_autoptr(GError) error = NULL;
+       g_autoptr(GsPluginLoader) plugin_loader = NULL;
+       const gchar *whitelist[] = {
+               "appstream",
+               "dummy",
+               "epiphany",
+               "hardcoded-blacklist",
+               "icons",
+               "menu-spec-refine",
+               "provenance",
+               NULL
+       };
+
        g_test_init (&argc, &argv, NULL);
        g_setenv ("G_MESSAGES_DEBUG", "all", TRUE);
-       g_setenv ("GNOME_SOFTWARE_SELF_TEST", "1", TRUE);
+
+       /* set all the things required as a dummy test harness */
+       g_setenv ("GS_SELF_TEST_LOCALE", "en_GB", TRUE);
+       g_setenv ("GS_SELF_TEST_DUMMY_ENABLE", "1", TRUE);
+       g_setenv ("GS_SELF_TEST_PROVENANCE_SOURCES", "london*,boston", TRUE);
+
+       fn = gs_test_get_filename ("icons/hicolor/48x48/org.gnome.Software.png");
+       g_assert (fn != NULL);
+       xml = g_strdup_printf ("<?xml version=\"1.0\"?>\n"
+               "<components version=\"0.9\">\n"
+               "  <component type=\"desktop\">\n"
+               "    <id>zeus.desktop</id>\n"
+               "    <name>Zeus</name>\n"
+               "    <summary>A teaching application</summary>\n"
+               "    <pkgname>zeus</pkgname>\n"
+               "    <icon type=\"stock\">drive-harddisk</icon>\n"
+               "    <categories>\n"
+               "      <category>AudioVideo</category>\n"
+               "      <category>Player</category>\n"
+               "    </categories>\n"
+               "    <languages>\n"
+               "      <lang percentage=\"100\">en_GB</lang>\n"
+               "    </languages>\n"
+               "  </component>\n"
+               "  <component type=\"desktop\">\n"
+               "    <id>mate-spell.desktop</id>\n"
+               "    <name>Spell</name>\n"
+               "    <summary>A spelling application for MATE</summary>\n"
+               "    <pkgname>mate-spell</pkgname>\n"
+               "    <icon type=\"stock\">drive-harddisk</icon>\n"
+               "    <project_group>MATE</project_group>\n"
+               "  </component>\n"
+               "  <component type=\"addon\">\n"
+               "    <id>zeus-spell.addon</id>\n"
+               "    <extends>zeus.desktop</extends>\n"
+               "    <name>Spell Check</name>\n"
+               "    <summary>Check the spelling when teaching</summary>\n"
+               "    <pkgname>zeus-spell</pkgname>\n"
+               "  </component>\n"
+               "  <component type=\"desktop\">\n"
+               "    <id>Uninstall Zeus.desktop</id>\n"
+               "    <name>Uninstall Zeus</name>\n"
+               "    <summary>Uninstall the teaching application</summary>\n"
+               "    <icon type=\"stock\">drive-harddisk</icon>\n"
+               "  </component>\n"
+               "  <component type=\"os-upgrade\">\n"
+               "    <id>org.fedoraproject.release-24.upgrade</id>\n"
+               "    <summary>Release specific tagline</summary>\n"
+               "  </component>\n"
+               "  <component type=\"webapp\">\n"
+               "    <id>arachne.desktop</id>\n"
+               "    <name>test</name>\n"
+               "    <icon type=\"remote\">file://%s</icon>\n"
+               "  </component>\n"
+               "</components>\n", fn);
+       g_setenv ("GS_SELF_TEST_APPSTREAM_XML", xml, TRUE);
 
        /* only critical and error are fatal */
        g_log_set_fatal_mask (NULL, G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL);
 
-       /* tests go here */
-       g_test_add_func ("/gnome-software/plugin-loader{refine}", gs_plugin_loader_refine_func);
-       g_test_add_func ("/gnome-software/plugin", gs_plugin_func);
+       /* generic tests go here */
        g_test_add_func ("/gnome-software/app", gs_app_func);
        g_test_add_func ("/gnome-software/app{subsume}", gs_app_subsume_func);
-       if(0)g_test_add_func ("/gnome-software/plugin-loader", gs_plugin_loader_func);
-       if(0)g_test_add_func ("/gnome-software/plugin-loader{webapps}", gs_plugin_loader_webapps_func);
+       g_test_add_func ("/gnome-software/plugin", gs_plugin_func);
 
+       /* we can only load this once per process */
+       plugin_loader = gs_plugin_loader_new ();
+       g_signal_connect (plugin_loader, "status-changed",
+                         G_CALLBACK (gs_plugin_loader_status_changed_cb), NULL);
+       gs_plugin_loader_set_location (plugin_loader, "./plugins/.libs");
+       ret = gs_plugin_loader_setup (plugin_loader, (gchar**) whitelist, &error);
+       g_assert_no_error (error);
+       g_assert (ret);
+       g_assert (!gs_plugin_loader_get_enabled (plugin_loader, "notgoingtoexist"));
+       g_assert (!gs_plugin_loader_get_enabled (plugin_loader, "packagekit"));
+       g_assert (gs_plugin_loader_get_enabled (plugin_loader, "appstream"));
+       g_assert (gs_plugin_loader_get_enabled (plugin_loader, "dummy"));
+
+       /* plugin tests go here */
+       g_test_add_data_func ("/gnome-software/plugin-loader{webapps}",
+                             plugin_loader,
+                             (GTestDataFunc) gs_plugin_loader_webapps_func);
+       g_test_add_data_func ("/gnome-software/plugin-loader{search}",
+                             plugin_loader,
+                             (GTestDataFunc) gs_plugin_loader_search_func);
+       g_test_add_data_func ("/gnome-software/plugin-loader{installed}",
+                             plugin_loader,
+                             (GTestDataFunc) gs_plugin_loader_installed_func);
+       g_test_add_data_func ("/gnome-software/plugin-loader{refine}",
+                             plugin_loader,
+                             (GTestDataFunc) gs_plugin_loader_refine_func);
+       g_test_add_data_func ("/gnome-software/plugin-loader{updates}",
+                             plugin_loader,
+                             (GTestDataFunc) gs_plugin_loader_updates_func);
+       g_test_add_data_func ("/gnome-software/plugin-loader{distro-upgrades}",
+                             plugin_loader,
+                             (GTestDataFunc) gs_plugin_loader_distro_upgrades_func);
        return g_test_run ();
 }
 
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index 4f1696e..6dd5413 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -157,6 +157,7 @@ gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
        GPtrArray *items;
        gboolean ret;
        const gchar *origin;
+       const gchar *tmp;
        guint *perc;
        guint i;
        g_autoptr(GHashTable) origins = NULL;
@@ -166,17 +167,26 @@ gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
                as_store_set_add_flags (plugin->priv->store,
                                        AS_STORE_ADD_FLAG_PREFER_LOCAL);
        }
-       ret = as_store_load (plugin->priv->store,
-                            AS_STORE_LOAD_FLAG_APP_INFO_SYSTEM |
-                            AS_STORE_LOAD_FLAG_APP_INFO_USER |
-                            AS_STORE_LOAD_FLAG_APPDATA |
-                            AS_STORE_LOAD_FLAG_DESKTOP |
-                            AS_STORE_LOAD_FLAG_XDG_APP_USER |
-                            AS_STORE_LOAD_FLAG_APP_INSTALL,
-                            NULL,
-                            error);
-       if (!ret)
-               return FALSE;
+
+       /* only when in self test */
+       tmp = g_getenv ("GS_SELF_TEST_APPSTREAM_XML");
+       if (tmp != NULL) {
+               g_debug ("using self test data of %s", tmp);
+               if (!as_store_from_xml (plugin->priv->store, tmp, NULL, error))
+                       return FALSE;
+       } else {
+               ret = as_store_load (plugin->priv->store,
+                                    AS_STORE_LOAD_FLAG_APP_INFO_SYSTEM |
+                                    AS_STORE_LOAD_FLAG_APP_INFO_USER |
+                                    AS_STORE_LOAD_FLAG_APPDATA |
+                                    AS_STORE_LOAD_FLAG_DESKTOP |
+                                    AS_STORE_LOAD_FLAG_XDG_APP_USER |
+                                    AS_STORE_LOAD_FLAG_APP_INSTALL,
+                                    NULL,
+                                    error);
+               if (!ret)
+                       return FALSE;
+       }
        items = as_store_get_apps (plugin->priv->store);
        if (items->len == 0) {
                g_warning ("No AppStream data, try 'make install-sample-data' in data/");
diff --git a/src/plugins/gs-plugin-dummy.c b/src/plugins/gs-plugin-dummy.c
index f9ca513..91a93a6 100644
--- a/src/plugins/gs-plugin-dummy.c
+++ b/src/plugins/gs-plugin-dummy.c
@@ -26,9 +26,6 @@
 /*
  * SECTION:
  * Provides some dummy data that is useful in self test programs.
- *
- * Methods:     | Search, AddUpdates, AddInstalled, AddPopular
- * Refines:     | [id]->[name], [id]->[summary]
  */
 
 /**
@@ -46,7 +43,7 @@ gs_plugin_get_name (void)
 void
 gs_plugin_initialize (GsPlugin *plugin)
 {
-       if (g_getenv ("GNOME_SOFTWARE_SELF_TEST") == NULL) {
+       if (g_getenv ("GS_SELF_TEST_DUMMY_ENABLE") == NULL) {
                g_debug ("disabling '%s' as not in self test", plugin->name);
                gs_plugin_set_enabled (plugin, FALSE);
        }
@@ -142,6 +139,7 @@ gs_plugin_add_updates (GsPlugin *plugin,
                       GError **error)
 {
        GsApp *app;
+       g_autoptr(AsIcon) ic = NULL;
 
        /* update UI as this might take some time */
        gs_plugin_status_update (plugin, NULL, GS_PLUGIN_STATUS_WAITING);
@@ -150,29 +148,48 @@ gs_plugin_add_updates (GsPlugin *plugin,
        if (!gs_plugin_dummy_delay (plugin, NULL, 2000, cancellable, error))
                return FALSE;
 
-       /* add a normal application */
-       app = gs_app_new ("gnome-boxes");
-       gs_app_set_name (app, GS_APP_QUALITY_NORMAL, "Boxes");
-       gs_app_set_summary (app, GS_APP_QUALITY_NORMAL, "Do not segfault when using newer versons of 
libvirt.");
+       /* use a generic stock icon */
+       ic = as_icon_new ();
+       as_icon_set_kind (ic, AS_ICON_KIND_STOCK);
+       as_icon_set_name (ic, "drive-harddisk");
+
+       /* add a live updatable normal application */
+       app = gs_app_new ("chiron.desktop");
+       gs_app_set_name (app, GS_APP_QUALITY_NORMAL, "Chiron");
+       gs_app_set_summary (app, GS_APP_QUALITY_NORMAL, "A teaching application");
+       gs_app_set_update_details (app, "Do not crash when using libvirt.");
+       gs_app_set_update_urgency (app, AS_URGENCY_KIND_HIGH);
+       gs_app_set_icon (app, ic);
        gs_app_set_kind (app, AS_APP_KIND_DESKTOP);
+       gs_app_set_state (app, AS_APP_STATE_UPDATABLE_LIVE);
        gs_app_set_management_plugin (app, plugin->name);
        gs_plugin_add_app (list, app);
        g_object_unref (app);
 
-       /* add an OS update */
-       app = gs_app_new ("libvirt-glib-devel;0.0.1;noarch;fedora");
+       /* add a offline OS update */
+       app = gs_app_new (NULL);
        gs_app_set_name (app, GS_APP_QUALITY_NORMAL, "libvirt-glib-devel");
-       gs_app_set_summary (app, GS_APP_QUALITY_NORMAL, "Fix several memory leaks.");
-       gs_app_set_kind (app, AS_APP_KIND_DESKTOP);
+       gs_app_set_summary (app, GS_APP_QUALITY_NORMAL, "Development files for libvirt");
+       gs_app_set_update_details (app, "Fix several memory leaks.");
+       gs_app_set_update_urgency (app, AS_URGENCY_KIND_LOW);
+       gs_app_set_kind (app, AS_APP_KIND_GENERIC);
+       gs_app_set_state (app, AS_APP_STATE_UPDATABLE);
+       gs_app_add_source (app, "libvirt-glib-devel");
+       gs_app_add_source_id (app, "libvirt-glib-devel;0.0.1;noarch;fedora");
        gs_app_set_management_plugin (app, plugin->name);
        gs_plugin_add_app (list, app);
        g_object_unref (app);
 
-       /* add a second OS update */
-       app = gs_app_new ("gnome-boxes-libs;0.0.1;i386;updates-testing");
-       gs_app_set_name (app, GS_APP_QUALITY_NORMAL, "gnome-boxes-libs");
-       gs_app_set_summary (app, GS_APP_QUALITY_NORMAL, "Do not segfault when using newer versons of 
libvirt.");
-       gs_app_set_kind (app, AS_APP_KIND_DESKTOP);
+       /* add a live OS update */
+       app = gs_app_new (NULL);
+       gs_app_set_name (app, GS_APP_QUALITY_NORMAL, "chiron-libs");
+       gs_app_set_summary (app, GS_APP_QUALITY_NORMAL, "library for chiron");
+       gs_app_set_update_details (app, "Do not crash when using libvirt.");
+       gs_app_set_update_urgency (app, AS_URGENCY_KIND_HIGH);
+       gs_app_set_kind (app, AS_APP_KIND_GENERIC);
+       gs_app_set_state (app, AS_APP_STATE_UPDATABLE_LIVE);
+       gs_app_add_source (app, "chiron-libs");
+       gs_app_add_source_id (app, "chiron-libs;0.0.1;i386;updates-testing");
        gs_app_set_management_plugin (app, plugin->name);
        gs_plugin_add_app (list, app);
        g_object_unref (app);
@@ -189,35 +206,29 @@ gs_plugin_add_installed (GsPlugin *plugin,
                         GCancellable *cancellable,
                         GError **error)
 {
-       g_autoptr(GsApp) app = gs_app_new ("gnome-power-manager");
-       gs_app_set_name (app, GS_APP_QUALITY_NORMAL, "Power Manager");
-       gs_app_set_summary (app, GS_APP_QUALITY_NORMAL, "Power Management Program");
-       gs_app_set_state (app, AS_APP_STATE_AVAILABLE);
-       gs_app_set_kind (app, AS_APP_KIND_DESKTOP);
-       gs_app_set_management_plugin (app, plugin->name);
-       gs_plugin_add_app (list, app);
-
-       return TRUE;
-}
+       const gchar *packages[] = { "zeus", "zeus-common", NULL };
+       const gchar *app_ids[] = { "Uninstall Zeus.desktop", NULL };
+       guint i;
+
+       /* add all packages */
+       for (i = 0; packages[i] != NULL; i++) {
+               g_autoptr(GsApp) app = gs_app_new (NULL);
+               gs_app_add_source (app, packages[i]);
+               gs_app_set_state (app, AS_APP_STATE_INSTALLED);
+               gs_app_set_kind (app, AS_APP_KIND_GENERIC);
+               gs_app_set_origin (app, "london-west");
+               gs_app_set_management_plugin (app, plugin->name);
+               gs_plugin_add_app (list, app);
+       }
 
-/**
- * gs_plugin_add_popular:
- */
-gboolean
-gs_plugin_add_popular (GsPlugin *plugin,
-                      GList **list,
-                      GCancellable *cancellable,
-                      GError **error)
-{
-       g_autoptr(GsApp) app = gs_app_new ("gnome-power-manager");
-       gs_app_add_quirk (app, AS_APP_QUIRK_MATCH_ANY_PREFIX);
-       gs_app_set_name (app, GS_APP_QUALITY_NORMAL, "Power Manager");
-       gs_app_set_summary (app, GS_APP_QUALITY_NORMAL, "Power Management Program");
-       gs_app_set_state (app, AS_APP_STATE_AVAILABLE);
-       gs_app_set_kind (app, AS_APP_KIND_DESKTOP);
-       gs_app_set_management_plugin (app, plugin->name);
-       gs_plugin_add_app (list, app);
-       gs_app_set_kind (app, AS_APP_KIND_DESKTOP);
+       /* add all app-ids */
+       for (i = 0; app_ids[i] != NULL; i++) {
+               g_autoptr(GsApp) app = gs_app_new (app_ids[i]);
+               gs_app_set_state (app, AS_APP_STATE_INSTALLED);
+               gs_app_set_kind (app, AS_APP_KIND_DESKTOP);
+               gs_app_set_management_plugin (app, plugin->name);
+               gs_plugin_add_app (list, app);
+       }
 
        return TRUE;
 }
@@ -232,18 +243,32 @@ gs_plugin_refine_app (GsPlugin *plugin,
                      GCancellable *cancellable,
                      GError **error)
 {
-       /* pkgname */
-       if (gs_app_get_name (app) == NULL) {
-               if (g_strcmp0 (gs_app_get_id (app), "gnome-boxes") == 0) {
-                       gs_app_set_license (app, GS_APP_QUALITY_NORMAL,
-                                           "GPL-2.0+");
-                       gs_app_set_name (app, GS_APP_QUALITY_NORMAL,
-                                        "Boxes");
+       /* default */
+       if (g_strcmp0 (gs_app_get_id (app), "chiron.desktop") == 0 ||
+           g_strcmp0 (gs_app_get_id (app), "mate-spell.desktop") == 0 ||
+           g_strcmp0 (gs_app_get_id (app), "zeus.desktop") == 0) {
+               if (gs_app_get_state (app) == AS_APP_STATE_UNKNOWN)
+                       gs_app_set_state (app, AS_APP_STATE_INSTALLED);
+       }
+
+       /* license */
+       if (flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_LICENSE) {
+               if (g_strcmp0 (gs_app_get_id (app), "chiron.desktop") == 0 ||
+                   g_strcmp0 (gs_app_get_id (app), "zeus.desktop") == 0)
+                       gs_app_set_license (app, GS_APP_QUALITY_NORMAL, "GPL-2.0+");
+       }
+
+       /* homepage */
+       if (flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_URL) {
+               if (g_strcmp0 (gs_app_get_id (app), "chiron.desktop") == 0) {
                        gs_app_set_url (app, AS_URL_KIND_HOMEPAGE,
-                                       "http://www.gimp.org/";);
-                       gs_app_set_summary (app, GS_APP_QUALITY_NORMAL,
-                                           "A simple GNOME 3 application "
-                                           "to access remote or virtual systems");
+                                       "http://www.test.org/";);
+               }
+       }
+
+       /* description */
+       if (flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_DESCRIPTION) {
+               if (g_strcmp0 (gs_app_get_id (app), "chiron.desktop") == 0) {
                        gs_app_set_description (app, GS_APP_QUALITY_NORMAL,
                                                "<p>long description!</p>");
                }
@@ -306,13 +331,13 @@ gs_plugin_add_category_apps (GsPlugin *plugin,
                             GCancellable *cancellable,
                             GError **error)
 {
-       g_autoptr(GsApp) app = gs_app_new ("gnome-boxes");
-       gs_app_set_name (app, GS_APP_QUALITY_NORMAL, "Boxes");
+       g_autoptr(GsApp) app = gs_app_new ("chiron.desktop");
+       gs_app_set_name (app, GS_APP_QUALITY_NORMAL, "Chiron");
        gs_app_set_summary (app, GS_APP_QUALITY_NORMAL, "View and use virtual machines");
        gs_app_set_url (app, AS_URL_KIND_HOMEPAGE, "http://www.box.org";);
        gs_app_set_kind (app, AS_APP_KIND_DESKTOP);
        gs_app_set_state (app, AS_APP_STATE_AVAILABLE);
-       gs_app_set_pixbuf (app, gdk_pixbuf_new_from_file 
("/usr/share/icons/hicolor/48x48/apps/gnome-boxes.png", NULL));
+       gs_app_set_pixbuf (app, gdk_pixbuf_new_from_file 
("/usr/share/icons/hicolor/48x48/apps/chiron.desktop.png", NULL));
        gs_app_set_kind (app, AS_APP_KIND_DESKTOP);
        gs_app_set_management_plugin (app, plugin->name);
        gs_plugin_add_app (list, app);
@@ -333,6 +358,8 @@ gs_plugin_add_distro_upgrades (GsPlugin *plugin,
        gs_app_set_kind (app, AS_APP_KIND_OS_UPGRADE);
        gs_app_set_state (app, AS_APP_STATE_AVAILABLE);
        gs_app_set_name (app, GS_APP_QUALITY_LOWEST, "Fedora");
+       gs_app_set_summary (app, GS_APP_QUALITY_NORMAL,
+                           "A major upgrade, with new features and added polish.");
        gs_app_set_url (app, AS_URL_KIND_HOMEPAGE,
                        "https://fedoraproject.org/wiki/Releases/24/Schedule";);
        gs_app_set_version (app, "24");
diff --git a/src/plugins/gs-plugin-provenance.c b/src/plugins/gs-plugin-provenance.c
index 1c61ab5..dd424a4 100644
--- a/src/plugins/gs-plugin-provenance.c
+++ b/src/plugins/gs-plugin-provenance.c
@@ -46,6 +46,21 @@ gs_plugin_get_name (void)
 }
 
 /**
+ * gs_plugin_provenance_get_sources:
+ */
+static gchar **
+gs_plugin_provenance_get_sources (GsPlugin *plugin)
+{
+       const gchar *tmp;
+       tmp = g_getenv ("GS_SELF_TEST_PROVENANCE_SOURCES");
+       if (tmp != NULL) {
+               g_debug ("using custom provenance sources of %s", tmp);
+               return g_strsplit (tmp, ",", -1);
+       }
+       return g_settings_get_strv (plugin->priv->settings, "official-sources");
+}
+
+/**
  * gs_plugin_provenance_settings_changed_cb:
  */
 static void
@@ -55,8 +70,7 @@ gs_plugin_provenance_settings_changed_cb (GSettings *settings,
 {
        if (g_strcmp0 (key, "official-sources") == 0) {
                g_strfreev (plugin->priv->sources);
-               plugin->priv->sources = g_settings_get_strv (plugin->priv->settings,
-                                                            "official-sources");
+               plugin->priv->sources = gs_plugin_provenance_get_sources (plugin);
        }
 }
 
@@ -70,8 +84,7 @@ gs_plugin_initialize (GsPlugin *plugin)
        plugin->priv->settings = g_settings_new ("org.gnome.software");
        g_signal_connect (plugin->priv->settings, "changed",
                          G_CALLBACK (gs_plugin_provenance_settings_changed_cb), plugin);
-       plugin->priv->sources = g_settings_get_strv (plugin->priv->settings,
-                                                  "official-sources");
+       plugin->priv->sources = gs_plugin_provenance_get_sources (plugin);
 }
 
 /**



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