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,
30 g_print ("Got id: %s %s\n", nai, password);
32 return GINT_TO_POINTER (success);
38 MoonshotError *error = NULL;
41 success = GPOINTER_TO_INT (test_func (&error));
46 g_print ("FAIL: %s\n", error->message);
47 g_assert_not_reached ();
50 void test_multithread ()
55 MoonshotError *error[N];
58 GError *g_error = NULL;
63 thread[i] = g_thread_create (test_func,
67 g_assert_no_error (g_error);
71 success[i] = GPOINTER_TO_INT (g_thread_join (thread[i]));
75 g_print ("FAIL[%i]: %s\n", i, error[i]->message);
76 g_assert_not_reached ();
81 /* More stuff to test:
82 * - server not available (dbus fail)
83 * - no identities available (moonshot fail)
88 int main (int argc, char *argv[])
91 g_test_init (&argc, &argv, NULL);
93 g_test_add_func ("/basic/connect", test_connect);
94 g_test_add_func ("/basic/multithread", test_multithread);