[gnome-keyring/dbus-api] [secret] Add tests to secret-store component.



commit 5f2473bbebcfc5320dc8d874134ca3d3bd9d0c69
Author: Stefan Walter <Stefan Walter>
Date:   Mon Aug 3 14:44:49 2009 +0000

    [secret] Add tests to secret-store component.

 configure.in                                       |    1 +
 pkcs11/secret-store/Makefile.am                    |    9 +++
 pkcs11/secret-store/tests/.gitignore               |    4 +
 pkcs11/secret-store/tests/Makefile.am              |   11 ++++
 .../secret-store/tests/unit-test-secret-compat.c   |   63 ++++++++++++++++++++
 5 files changed, 88 insertions(+), 0 deletions(-)
---
diff --git a/configure.in b/configure.in
index 553efca..8706259 100644
--- a/configure.in
+++ b/configure.in
@@ -587,6 +587,7 @@ pkcs11/roots-store/Makefile
 pkcs11/roots-store/tests/Makefile
 pkcs11/rpc-layer/Makefile
 pkcs11/secret-store/Makefile
+pkcs11/secret-store/tests/Makefile
 pkcs11/ssh-agent/Makefile
 pkcs11/ssh-store/Makefile
 pkcs11/ssh-store/tests/Makefile
diff --git a/pkcs11/secret-store/Makefile.am b/pkcs11/secret-store/Makefile.am
index 5d9e7b3..aa13981 100644
--- a/pkcs11/secret-store/Makefile.am
+++ b/pkcs11/secret-store/Makefile.am
@@ -49,3 +49,12 @@ gck_secret_store_standalone_la_LIBADD = \
 	$(LIBGCRYPT_LIBS)
 
 # -------------------------------------------------------------------------------
+
+
+if WITH_TESTS
+TESTS_DIR = tests
+else
+TESTS_DIR = 
+endif
+
+SUBDIRS = . $(TESTS_DIR)
diff --git a/pkcs11/secret-store/tests/.gitignore b/pkcs11/secret-store/tests/.gitignore
new file mode 100644
index 0000000..17416be
--- /dev/null
+++ b/pkcs11/secret-store/tests/.gitignore
@@ -0,0 +1,4 @@
+run-auto-test*
+.libs
+.deps
+
diff --git a/pkcs11/secret-store/tests/Makefile.am b/pkcs11/secret-store/tests/Makefile.am
new file mode 100644
index 0000000..d91d4be
--- /dev/null
+++ b/pkcs11/secret-store/tests/Makefile.am
@@ -0,0 +1,11 @@
+UNIT_AUTO = \
+	unit-test-secret-compat.c
+
+UNIT_PROMPT = 
+
+UNIT_LIBS =  \
+	$(top_builddir)/pkcs11/secret-store/libgck-secret-store.la \
+	$(top_builddir)/pkcs11/gck/libgck.la \
+	$(top_builddir)/egg/libegg.la
+
+include $(top_srcdir)/tests/gtest.make
diff --git a/pkcs11/secret-store/tests/unit-test-secret-compat.c b/pkcs11/secret-store/tests/unit-test-secret-compat.c
new file mode 100644
index 0000000..579753c
--- /dev/null
+++ b/pkcs11/secret-store/tests/unit-test-secret-compat.c
@@ -0,0 +1,63 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* unit-test-ssh-openssh.c: Test OpenSSH parsing
+
+   Copyright (C) 2008 Stefan Walter
+
+   The Gnome Keyring Library 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 Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The Gnome Keyring Library 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 Library General Public
+   License along with the Gnome Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.
+
+   Author: Stef Walter <stef memberwebs com>
+*/
+
+#include "config.h"
+
+#include "run-auto-test.h"
+
+#include "gck-secret-compat.h"
+
+#include <glib.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+DEFINE_TEST(access_free)
+{
+	GckSecretAccess *ac;
+
+	ac = g_new0 (GckSecretAccess, 1);
+	ac->pathname = g_strdup ("/path");
+	ac->display_name = g_strdup ("Display");
+	ac->types_allowed = GCK_SECRET_ACCESS_READ;
+	
+	gck_secret_compat_access_free (ac);
+}
+
+DEFINE_TEST(acl_free)
+{
+	GckSecretAccess *ac;
+	GList *acl = NULL;
+	int i;
+	
+	for (i = 0; i < 10; ++i) {
+		ac = g_new0 (GckSecretAccess, 1);
+		ac->pathname = g_strdup ("/path");
+		ac->display_name = g_strdup ("Display");
+		ac->types_allowed = GCK_SECRET_ACCESS_READ;
+		acl = g_list_prepend (acl, ac);
+	}
+	
+	gck_secret_compat_acl_free (acl);
+}



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