8bd09a0c8bfc45d1fe44d42b273afe30ff737cca
[moonshot-ui.git] / tests / basic.c
1 #include <glib.h>
2
3 #include "libmoonshot.h"
4
5 void test_connect ()
6 {
7     char *nai,
8          *password,
9          *server_certificate_hash,
10          *ca_certificate,
11          *subject_name_constraint,
12          *subject_alt_name_constraint;
13     int success;
14     MoonshotError *error = NULL;
15
16     success = moonshot_get_identity ("test",
17                                      "test",
18                                      "test",
19                                      &nai,
20                                      &password,
21                                      &server_certificate_hash,
22                                      &ca_certificate,
23                                      &subject_name_constraint,
24                                      &subject_alt_name_constraint,
25                                      &error);
26
27     if (success == 0) {
28         g_print ("FAIL %s\n", error->message);
29     } else {
30         g_print ("PASS\n");
31     }
32 }
33
34 /* More stuff to test:
35  *   - server not available (dbus fail)
36  *   - no identities available (moonshot fail)
37  *   - valgrind
38  */
39
40 int main (int argc, char *argv[])
41 {
42     g_type_init ();
43     g_test_init (&argc, &argv, NULL);
44
45     g_test_add_func ("/basic/connect", test_connect);
46
47     g_test_run ();
48 }