[tracker/miner-web: 29/31] libtracker-miner: Add a test for TrackerPasswordProvider
- From: Adrien Bustany <abustany src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker/miner-web: 29/31] libtracker-miner: Add a test for TrackerPasswordProvider
- Date: Thu, 12 Nov 2009 20:40:28 +0000 (UTC)
commit d67ccb363f29a2c74bdb8c0273abe6d2b2eaecc8
Author: Adrien Bustany <madcat mymadcat com>
Date: Thu Nov 12 16:01:22 2009 -0300
libtracker-miner: Add a test for TrackerPasswordProvider
src/libtracker-miner/test/password-provider-test.c | 56 ++++++++++++++++++++
1 files changed, 56 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-miner/test/password-provider-test.c b/src/libtracker-miner/test/password-provider-test.c
new file mode 100644
index 0000000..80fdeac
--- /dev/null
+++ b/src/libtracker-miner/test/password-provider-test.c
@@ -0,0 +1,56 @@
+#include "config.h"
+#include <libtracker-miner/tracker-password-provider.h>
+
+#define SERVICE_NAME "TestService"
+
+int main (int argc, char **argv)
+{
+ g_type_init ();
+ g_set_application_name ("PasswordBackendTest");
+
+ TrackerPasswordProvider *p = tracker_password_provider_get_password_provider ();
+
+ GError *error = NULL;
+ tracker_password_provider_store_password (p, SERVICE_NAME, "This is the test service", "testUser", "testPass", &error);
+
+ if (error) {
+ g_critical ("tracker_password_provider_store: %s", error->message);
+ g_error_free (error);
+
+ return 1;
+ }
+
+ gchar *username = NULL;
+
+ gchar *password = tracker_password_provider_get_password (p, SERVICE_NAME, &username, &error);
+
+ if (error) {
+ g_critical ("tracker_password_provider_get: %s", error->message);
+ g_error_free (error);
+
+ return 1;
+ } else {
+ g_message ("Username: %s , Password:%s", username, password);
+ }
+
+ g_free (username);
+ username = NULL;
+ g_free (password);
+
+ // Also test without getting the username
+ password = tracker_password_provider_get_password (p, SERVICE_NAME, NULL, &error);
+
+ if (error) {
+ g_critical ("tracker_password_provider_get: %s", error->message);
+ g_error_free (error);
+
+ return 1;
+ } else {
+ g_message ("Username: %s , Password:%s", username, password);
+ }
+
+ g_free (username);
+ g_free (password);
+ g_free (p);
+ return 0;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]