3 #include "libmoonshot.h"
5 /* FIXME: Using XDG_HOME_DIR and a test runner, we could give
6 * moonshot-ui a set of test identities and assert that they
7 * are returned correctly
10 gpointer test_func (gpointer data)
12 MoonshotError **error = data;
17 *server_certificate_hash,
19 *subject_name_constraint,
20 *subject_alt_name_constraint;
22 success = moonshot_get_default_identity (&nai,
24 &server_certificate_hash,
26 &subject_name_constraint,
27 &subject_alt_name_constraint,
31 g_print ("Got id: %s %s\n", nai, password);*/
34 moonshot_free (password);
35 moonshot_free (server_certificate_hash);
36 moonshot_free (ca_certificate);
37 moonshot_free (subject_name_constraint);
38 moonshot_free (subject_alt_name_constraint);
40 return GINT_TO_POINTER (success);
46 MoonshotError *error = NULL;
49 success = GPOINTER_TO_INT (test_func (&error));
54 g_print ("FAIL: %s\n", error->message);
55 g_assert_not_reached ();
58 void test_multithread ()
63 MoonshotError *error[N];
66 GError *g_error = NULL;
71 thread[i] = g_thread_create (test_func,
75 g_assert_no_error (g_error);
79 success[i] = GPOINTER_TO_INT (g_thread_join (thread[i]));
83 g_print ("FAIL[%i]: %s\n", i, error[i]->message);
84 g_assert_not_reached ();
89 /* More stuff to test:
90 * - server not available (dbus fail)
91 * - no identities available (moonshot fail)
96 int main (int argc, char *argv[])
99 g_test_init (&argc, &argv, NULL);
101 g_test_add_func ("/basic/connect", test_connect);
102 g_test_add_func ("/basic/multithread", test_multithread);