Added a new test for the OpenAccount DBus message
authorSergio Villar Senin <svillar@igalia.com>
Mon, 9 Mar 2009 16:51:13 +0000 (16:51 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Mon, 9 Mar 2009 16:51:13 +0000 (16:51 +0000)
pmo-trunk-r7903

tests/dbus_api/test_open_account.c [new file with mode: 0644]

diff --git a/tests/dbus_api/test_open_account.c b/tests/dbus_api/test_open_account.c
new file mode 100644 (file)
index 0000000..016019c
--- /dev/null
@@ -0,0 +1,38 @@
+#include <libmodest-dbus-client/libmodest-dbus-client.h>
+#include <stdio.h>
+
+int
+main (int argc, char *argv[])
+{
+       osso_context_t *osso_context;
+       const char *url = NULL;
+       gboolean ret;
+
+       osso_context = osso_initialize ("test_open_account",
+                                       "0.0.1",
+                                       TRUE,
+                                       NULL);
+
+       if (osso_context == NULL) {
+               g_printerr ("osso_initialize() failed.\n");
+           return -1;
+       }
+
+       if (argc == 2) {
+               url = argv[1];
+       } else {
+               g_printerr ("No account ID argument supplied on the command line.\n");
+               return -1;
+       }
+
+       g_print ("Trying to open msg: %s\n", url);
+       ret = libmodest_dbus_client_open_account (osso_context, url);
+
+       if (!ret) {
+               g_printerr ("libmodest_dbus_client_open_account () failed.\n");
+       } else {
+               g_print ("libmodest_dbus_client_open_account () succeeded.\n");
+       }
+
+    return ret ? 0 : -1;
+}