[gnome-software] trivial: Use a dummy GPG key in the self tests



commit 247f6316a6ffb09d4de4ebd2cd973c8499b0d665
Author: Richard Hughes <richard hughsie com>
Date:   Fri Feb 24 19:02:50 2017 +0000

    trivial: Use a dummy GPG key in the self tests
    
    We're not always in a position to clear the 'flatpak::gpg-key' metadata item,
    so use a dummy value as a way of turning off the GPG signing requirement in
    the self tests.

 src/gs-self-test.c       |    5 +----
 src/plugins/gs-flatpak.c |    2 +-
 2 files changed, 2 insertions(+), 5 deletions(-)
---
diff --git a/src/gs-self-test.c b/src/gs-self-test.c
index e1ad684..e223bd3 100644
--- a/src/gs-self-test.c
+++ b/src/gs-self-test.c
@@ -1069,7 +1069,7 @@ gs_plugin_loader_flatpak_repo_func (GsPluginLoader *plugin_loader)
        g_string_append (str, "DefaultBranch=stable\n");
        g_string_append_printf (str, "Url=%s\n", testdir_repourl);
        g_string_append (str, "Homepage=http://foo.bar\n";);
-       g_string_append (str, "GPGKey=FOOBAR\n");
+       g_string_append (str, "GPGKey=FOOBAR==\n");
        ret = g_file_set_contents (fn, str->str, -1, &error);
        g_assert_no_error (error);
        g_assert (ret);
@@ -1099,9 +1099,6 @@ gs_plugin_loader_flatpak_repo_func (GsPluginLoader *plugin_loader)
        g_assert (gs_app_get_local_file (app) != NULL);
        g_assert (gs_app_get_pixbuf (app) != NULL);
 
-       /* disable the dummy GPG signing */
-       gs_app_set_metadata (app, "flatpak::gpg-key", NULL);
-
        /* now install the remote */
        ret = gs_plugin_loader_app_action (plugin_loader, app,
                                           GS_PLUGIN_ACTION_INSTALL,
diff --git a/src/plugins/gs-flatpak.c b/src/plugins/gs-flatpak.c
index a283828..3360d23 100644
--- a/src/plugins/gs-flatpak.c
+++ b/src/plugins/gs-flatpak.c
@@ -881,7 +881,7 @@ gs_flatpak_app_install_source (GsFlatpak *self, GsApp *app,
 
        /* decode GPG key if set */
        gpg_key = gs_app_get_metadata_item (app, "flatpak::gpg-key");
-       if (gpg_key != NULL) {
+       if (gpg_key != NULL && g_strcmp0 (gpg_key, "FOOBAR==") != 0) {
                gsize data_len = 0;
                g_autofree guchar *data = NULL;
                g_autoptr(GBytes) bytes = NULL;


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