summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2019-02-15 10:13:06 +0100
committerLubomir Rintel <lkundrak@v3.sk>2019-02-18 15:22:19 +0100
commit92ff6b2a30529a69e6d28353efc88470f4279880 (patch)
tree8444171ab0fcbb2d079557d2b2c3c8594bfdabfa
parentbafe99ac179a5e2644f3e3274211212540c95c26 (diff)
downloadnetwork-manager-applet-lr/cert-chooser-fixes.tar.gz
nma/tests: add certificate chooser test programlr/cert-chooser-fixes
-rw-r--r--.gitignore1
-rw-r--r--Makefile.am17
-rw-r--r--src/libnma/tests/cert-chooser.c73
-rw-r--r--src/libnma/tests/meson.build9
4 files changed, 100 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 423955b1..b93e1ecc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -56,6 +56,7 @@ src/libnma/NMA-1.0.typelib
src/libnma/nma-resources.c
src/libnma/nma-resources.h
src/libnma/nma-version.h
+src/libnma/tests/cert-chooser
src/libnma/tests/mobile-wizard
src/libnma/tests/run-vpn
src/libnma/tests/vpn-password-dialog
diff --git a/Makefile.am b/Makefile.am
index 5769b957..46095319 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -696,6 +696,23 @@ src_libnma_tests_run_vpn_LDADD = \
$(LIBNM_LIBS) \
src/libnma/libnma.la
+check_PROGRAMS_norun += src/libnma/tests/cert-chooser
+
+src_libnma_tests_cert_chooser_CPPFLAGS = \
+ $(dflt_cppflags) \
+ $(GLIB_CFLAGS) \
+ $(GTK3_CFLAGS) \
+ $(LIBNM_CFLAGS) \
+ "-I$(srcdir)/shared/" \
+ "-I$(srcdir)/src/libnma" \
+ -Isrc/libnma
+
+src_libnma_tests_cert_chooser_LDADD = \
+ $(GLIB_LIBS) \
+ $(GTK3_LIBS) \
+ $(LIBNM_LIBS) \
+ src/libnma/libnma.la
+
EXTRA_DIST += \
src/libnma/nma-version.h.in \
src/libnma/libnma.pc.in \
diff --git a/src/libnma/tests/cert-chooser.c b/src/libnma/tests/cert-chooser.c
new file mode 100644
index 00000000..9ba22ded
--- /dev/null
+++ b/src/libnma/tests/cert-chooser.c
@@ -0,0 +1,73 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the ree Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright 2019 Red Hat, Inc.
+ */
+
+#include "nm-default.h"
+
+#include <gtk/gtk.h>
+#include "nma-cert-chooser.h"
+
+int
+main (int argc, char *argv[])
+{
+ GtkWidget *dialog;
+ GtkBox *content;
+ GtkWidget *widget;
+
+ gtk_init (&argc, &argv);
+
+ dialog = gtk_dialog_new_with_buttons ("NMACertChooser test",
+ NULL, GTK_DIALOG_MODAL,
+ "Dismiss", GTK_RESPONSE_DELETE_EVENT,
+ NULL);
+ content = GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog)));
+
+ widget = nma_cert_chooser_new ("Any", 0);
+ gtk_widget_show (widget);
+ gtk_box_pack_start (content, widget, TRUE, TRUE, 6);
+
+ widget = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
+ gtk_widget_show (widget);
+ gtk_box_pack_start (content, widget, TRUE, TRUE, 6);
+
+ widget = nma_cert_chooser_new ("FLAG_PASSWORDS", NMA_CERT_CHOOSER_FLAG_PASSWORDS);
+ nma_cert_chooser_set_cert (NMA_CERT_CHOOSER (widget),
+ "pkcs11:object=praise;type=satan",
+ NM_SETTING_802_1X_CK_SCHEME_PKCS11);
+ nma_cert_chooser_set_key_uri (NMA_CERT_CHOOSER (widget),
+ "pkcs11:object=worship;type=doom");
+ gtk_widget_show (widget);
+ gtk_box_pack_start (content, widget, TRUE, TRUE, 6);
+
+ widget = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
+ gtk_widget_show (widget);
+ gtk_box_pack_start (content, widget, TRUE, TRUE, 6);
+
+ widget = nma_cert_chooser_new ("FLAG_CERT", NMA_CERT_CHOOSER_FLAG_CERT);
+ gtk_widget_show (widget);
+ gtk_box_pack_start (content, widget, TRUE, TRUE, 6);
+
+ widget = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
+ gtk_widget_show (widget);
+ gtk_box_pack_start (content, widget, TRUE, TRUE, 6);
+
+ widget = nma_cert_chooser_new ("FLAG_PEM", NMA_CERT_CHOOSER_FLAG_PEM);
+ gtk_widget_show (widget);
+ gtk_box_pack_start (content, widget, TRUE, TRUE, 6);
+
+ gtk_dialog_run (GTK_DIALOG (dialog));
+}
diff --git a/src/libnma/tests/meson.build b/src/libnma/tests/meson.build
index 4ac1543f..2d682e86 100644
--- a/src/libnma/tests/meson.build
+++ b/src/libnma/tests/meson.build
@@ -5,6 +5,15 @@ deps = [
]
executable(
+ 'cert-chooser',
+ 'cert-chooser.c',
+ include_directories: incs,
+ dependencies: deps,
+ c_args: cflags,
+ install: false
+)
+
+executable(
'mobile-wizard',
'mobile-wizard.c',
include_directories: incs,