collection: Have gobject-introspection and glib-mkenums recognize flags
[platform/upstream/libsecret.git] / libsecret / tests / test-paths.c
1 /* libsecret - GLib wrapper for Secret Service
2  *
3  * Copyright 2011 Collabora Ltd.
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public License as published
7  * by the Free Software Foundation; either version 2 of the licence or (at
8  * your option) any later version.
9  *
10  * See the included COPYING file for more information.
11  */
12
13
14 #include "config.h"
15
16 #include "secret-attributes.h"
17 #include "secret-collection.h"
18 #include "secret-item.h"
19 #include "secret-paths.h"
20 #include "secret-private.h"
21 #include "secret-service.h"
22
23 #include "mock-service.h"
24
25 #include "egg/egg-testing.h"
26
27 #include <glib.h>
28
29 #include <errno.h>
30 #include <stdlib.h>
31
32 static const SecretSchema MOCK_SCHEMA = {
33         "org.mock.Schema",
34         SECRET_SCHEMA_NONE,
35         {
36                 { "number", SECRET_SCHEMA_ATTRIBUTE_INTEGER },
37                 { "string", SECRET_SCHEMA_ATTRIBUTE_STRING },
38                 { "even", SECRET_SCHEMA_ATTRIBUTE_BOOLEAN },
39         }
40 };
41
42 static const SecretSchema PRIME_SCHEMA = {
43         "org.mock.Prime",
44         SECRET_SCHEMA_NONE,
45         {
46                 { "number", SECRET_SCHEMA_ATTRIBUTE_INTEGER },
47                 { "string", SECRET_SCHEMA_ATTRIBUTE_STRING },
48                 { "prime", SECRET_SCHEMA_ATTRIBUTE_BOOLEAN },
49         }
50 };
51
52 static const SecretSchema NO_NAME_SCHEMA = {
53         "unused.Schema.Name",
54         SECRET_SCHEMA_DONT_MATCH_NAME,
55         {
56                 { "number", SECRET_SCHEMA_ATTRIBUTE_INTEGER },
57                 { "string", SECRET_SCHEMA_ATTRIBUTE_STRING },
58         }
59 };
60
61 typedef struct {
62         SecretService *service;
63 } Test;
64
65 static void
66 setup_mock (Test *test,
67             gconstpointer data)
68 {
69         GError *error = NULL;
70         const gchar *mock_script = data;
71
72         mock_service_start (mock_script, &error);
73         g_assert_no_error (error);
74 }
75
76 static void
77 setup (Test *test,
78        gconstpointer data)
79 {
80         GError *error = NULL;
81
82         setup_mock (test, data);
83
84         test->service = secret_service_get_sync (SECRET_SERVICE_NONE, NULL, &error);
85         g_assert_no_error (error);
86 }
87
88 static void
89 teardown_mock (Test *test,
90                gconstpointer unused)
91 {
92         secret_service_disconnect ();
93         mock_service_stop ();
94 }
95
96 static void
97 teardown (Test *test,
98           gconstpointer unused)
99 {
100         egg_test_wait_idle ();
101
102         g_object_unref (test->service);
103         secret_service_disconnect ();
104         egg_assert_not_object (test->service);
105
106         teardown_mock (test, unused);
107 }
108
109 static void
110 on_complete_get_result (GObject *source,
111                         GAsyncResult *result,
112                         gpointer user_data)
113 {
114         GAsyncResult **ret = user_data;
115         g_assert (ret != NULL);
116         g_assert (*ret == NULL);
117         *ret = g_object_ref (result);
118         egg_test_wait_stop ();
119 }
120
121 static void
122 test_search_paths_sync (Test *test,
123                         gconstpointer used)
124 {
125         GHashTable *attributes;
126         gboolean ret;
127         gchar **locked;
128         gchar **unlocked;
129         GError *error = NULL;
130
131         attributes = g_hash_table_new (g_str_hash, g_str_equal);
132         g_hash_table_insert (attributes, "number", "1");
133
134         ret = secret_service_search_for_dbus_paths_sync (test->service, &MOCK_SCHEMA, attributes, NULL,
135                                                          &unlocked, &locked, &error);
136         g_assert_no_error (error);
137         g_assert (ret == TRUE);
138
139         g_assert (locked);
140         g_assert_cmpstr (locked[0], ==, "/org/freedesktop/secrets/collection/spanish/10");
141
142         g_assert (unlocked);
143         g_assert_cmpstr (unlocked[0], ==, "/org/freedesktop/secrets/collection/english/1");
144
145         g_strfreev (unlocked);
146         g_strfreev (locked);
147
148         g_hash_table_unref (attributes);
149 }
150
151 static void
152 test_search_paths_async (Test *test,
153                          gconstpointer used)
154 {
155         GAsyncResult *result = NULL;
156         GHashTable *attributes;
157         gboolean ret;
158         gchar **locked;
159         gchar **unlocked;
160         GError *error = NULL;
161
162         attributes = g_hash_table_new (g_str_hash, g_str_equal);
163         g_hash_table_insert (attributes, "number", "1");
164
165         secret_service_search_for_dbus_paths (test->service, &MOCK_SCHEMA, attributes, NULL,
166                                               on_complete_get_result, &result);
167         egg_test_wait ();
168
169         g_assert (G_IS_ASYNC_RESULT (result));
170         ret = secret_service_search_for_dbus_paths_finish (test->service, result,
171                                                                 &unlocked, &locked,
172                                                                 &error);
173         g_assert_no_error (error);
174         g_assert (ret == TRUE);
175
176         g_assert (locked);
177         g_assert_cmpstr (locked[0], ==, "/org/freedesktop/secrets/collection/spanish/10");
178
179         g_assert (unlocked);
180         g_assert_cmpstr (unlocked[0], ==, "/org/freedesktop/secrets/collection/english/1");
181
182         g_strfreev (unlocked);
183         g_strfreev (locked);
184         g_object_unref (result);
185
186         g_hash_table_unref (attributes);
187 }
188
189 static void
190 test_search_paths_nulls (Test *test,
191                          gconstpointer used)
192 {
193         GAsyncResult *result = NULL;
194         GHashTable *attributes;
195         gboolean ret;
196         gchar **paths;
197         GError *error = NULL;
198
199         attributes = g_hash_table_new (g_str_hash, g_str_equal);
200         g_hash_table_insert (attributes, "number", "1");
201
202         ret = secret_service_search_for_dbus_paths_sync (test->service, &MOCK_SCHEMA, attributes, NULL,
203                                                      &paths, NULL, &error);
204         g_assert_no_error (error);
205         g_assert (ret == TRUE);
206         g_assert (paths != NULL);
207         g_assert_cmpstr (paths[0], ==, "/org/freedesktop/secrets/collection/english/1");
208         g_strfreev (paths);
209
210         ret = secret_service_search_for_dbus_paths_sync (test->service, &MOCK_SCHEMA, attributes, NULL,
211                                                          NULL, &paths, &error);
212         g_assert_no_error (error);
213         g_assert (ret == TRUE);
214         g_assert (paths != NULL);
215         g_assert_cmpstr (paths[0], ==, "/org/freedesktop/secrets/collection/spanish/10");
216         g_strfreev (paths);
217
218         ret = secret_service_search_for_dbus_paths_sync (test->service, &MOCK_SCHEMA, attributes, NULL,
219                                                          NULL, NULL, &error);
220         g_assert_no_error (error);
221         g_assert (ret == TRUE);
222
223         secret_service_search_for_dbus_paths (test->service, &MOCK_SCHEMA, attributes, NULL,
224                                               on_complete_get_result, &result);
225         egg_test_wait ();
226         g_assert (G_IS_ASYNC_RESULT (result));
227         ret = secret_service_search_for_dbus_paths_finish (test->service, result,
228                                                            &paths, NULL, &error);
229         g_assert_no_error (error);
230         g_assert (ret == TRUE);
231         g_assert (paths != NULL);
232         g_assert_cmpstr (paths[0], ==, "/org/freedesktop/secrets/collection/english/1");
233         g_strfreev (paths);
234         g_clear_object (&result);
235
236         secret_service_search_for_dbus_paths (test->service, &MOCK_SCHEMA, attributes, NULL,
237                                               on_complete_get_result, &result);
238         egg_test_wait ();
239         g_assert (G_IS_ASYNC_RESULT (result));
240         ret = secret_service_search_for_dbus_paths_finish (test->service, result,
241                                                            NULL, &paths, &error);
242         g_assert_no_error (error);
243         g_assert (ret == TRUE);
244         g_assert (paths != NULL);
245         g_assert_cmpstr (paths[0], ==, "/org/freedesktop/secrets/collection/spanish/10");
246         g_strfreev (paths);
247         g_clear_object (&result);
248
249         secret_service_search_for_dbus_paths (test->service, &MOCK_SCHEMA, attributes, NULL,
250                                               on_complete_get_result, &result);
251         egg_test_wait ();
252         g_assert (G_IS_ASYNC_RESULT (result));
253         ret = secret_service_search_for_dbus_paths_finish (test->service, result,
254                                                            NULL, NULL, &error);
255         g_assert_no_error (error);
256         g_assert (ret == TRUE);
257         g_clear_object (&result);
258
259         g_hash_table_unref (attributes);
260 }
261
262 static void
263 test_secret_for_path_sync (Test *test,
264                            gconstpointer used)
265 {
266         SecretValue *value;
267         GError *error = NULL;
268         const gchar *path;
269         const gchar *password;
270         gsize length;
271
272         path = "/org/freedesktop/secrets/collection/english/1";
273         value = secret_service_get_secret_for_dbus_path_sync (test->service, path, NULL, &error);
274         g_assert_no_error (error);
275         g_assert (value != NULL);
276
277         password = secret_value_get (value, &length);
278         g_assert_cmpuint (length, ==, 3);
279         g_assert_cmpstr (password, ==, "111");
280
281         password = secret_value_get (value, NULL);
282         g_assert_cmpstr (password, ==, "111");
283
284         secret_value_unref (value);
285 }
286
287 static void
288 test_secret_for_path_async (Test *test,
289                             gconstpointer used)
290 {
291         SecretValue *value;
292         GError *error = NULL;
293         const gchar *path;
294         const gchar *password;
295         GAsyncResult *result = NULL;
296         gsize length;
297
298         path = "/org/freedesktop/secrets/collection/english/1";
299         secret_service_get_secret_for_dbus_path (test->service, path, NULL,
300                                                  on_complete_get_result, &result);
301         g_assert (result == NULL);
302         egg_test_wait ();
303
304         value = secret_service_get_secret_for_dbus_path_finish (test->service, result, &error);
305         g_assert_no_error (error);
306         g_assert (value != NULL);
307         g_object_unref (result);
308
309         password = secret_value_get (value, &length);
310         g_assert_cmpuint (length, ==, 3);
311         g_assert_cmpstr (password, ==, "111");
312
313         password = secret_value_get (value, NULL);
314         g_assert_cmpstr (password, ==, "111");
315
316         secret_value_unref (value);
317 }
318
319 static void
320 test_secrets_for_paths_sync (Test *test,
321                              gconstpointer used)
322 {
323         const gchar *path_item_one = "/org/freedesktop/secrets/collection/english/1";
324         const gchar *path_item_two = "/org/freedesktop/secrets/collection/english/2";
325         const gchar *paths[] = {
326                 path_item_one,
327                 path_item_two,
328
329                 /* This one is locked, and not returned */
330                 "/org/freedesktop/secrets/collection/spanish/10",
331                 NULL
332         };
333
334         SecretValue *value;
335         GHashTable *values;
336         GError *error = NULL;
337         const gchar *password;
338         gsize length;
339
340         values = secret_service_get_secrets_for_dbus_paths_sync (test->service, paths, NULL, &error);
341         g_assert_no_error (error);
342
343         g_assert (values != NULL);
344         g_assert_cmpuint (g_hash_table_size (values), ==, 2);
345
346         value = g_hash_table_lookup (values, path_item_one);
347         g_assert (value != NULL);
348         password = secret_value_get (value, &length);
349         g_assert_cmpuint (length, ==, 3);
350         g_assert_cmpstr (password, ==, "111");
351
352         value = g_hash_table_lookup (values, path_item_two);
353         g_assert (value != NULL);
354         password = secret_value_get (value, &length);
355         g_assert_cmpuint (length, ==, 3);
356         g_assert_cmpstr (password, ==, "222");
357
358         g_hash_table_unref (values);
359 }
360
361 static void
362 test_secrets_for_paths_async (Test *test,
363                               gconstpointer used)
364 {
365         const gchar *path_item_one = "/org/freedesktop/secrets/collection/english/1";
366         const gchar *path_item_two = "/org/freedesktop/secrets/collection/english/2";
367         const gchar *paths[] = {
368                 path_item_one,
369                 path_item_two,
370
371                 /* This one is locked, and not returned */
372                 "/org/freedesktop/secrets/collection/spanish/10",
373                 NULL
374         };
375
376         SecretValue *value;
377         GHashTable *values;
378         GError *error = NULL;
379         const gchar *password;
380         GAsyncResult *result = NULL;
381         gsize length;
382
383         secret_service_get_secrets_for_dbus_paths (test->service, paths, NULL,
384                                                    on_complete_get_result, &result);
385         g_assert (result == NULL);
386         egg_test_wait ();
387
388         values = secret_service_get_secrets_for_dbus_paths_finish (test->service, result, &error);
389         g_assert_no_error (error);
390         g_object_unref (result);
391
392         g_assert (values != NULL);
393         g_assert_cmpuint (g_hash_table_size (values), ==, 2);
394
395         value = g_hash_table_lookup (values, path_item_one);
396         g_assert (value != NULL);
397         password = secret_value_get (value, &length);
398         g_assert_cmpuint (length, ==, 3);
399         g_assert_cmpstr (password, ==, "111");
400
401         value = g_hash_table_lookup (values, path_item_two);
402         g_assert (value != NULL);
403         password = secret_value_get (value, &length);
404         g_assert_cmpuint (length, ==, 3);
405         g_assert_cmpstr (password, ==, "222");
406
407         g_hash_table_unref (values);
408 }
409
410 static void
411 test_delete_for_path_sync (Test *test,
412                            gconstpointer used)
413
414 {
415         const gchar *path_item_one = "/org/freedesktop/secrets/collection/todelete/item";
416         GError *error = NULL;
417         gboolean ret;
418
419         ret = secret_service_delete_item_dbus_path_sync (test->service, path_item_one, NULL, &error);
420         g_assert_no_error (error);
421         g_assert (ret == TRUE);
422 }
423
424 static void
425 test_delete_for_path_sync_prompt (Test *test,
426                                   gconstpointer used)
427
428 {
429         const gchar *path_item_one = "/org/freedesktop/secrets/collection/todelete/confirm";
430         GError *error = NULL;
431         gboolean ret;
432
433         ret = secret_service_delete_item_dbus_path_sync (test->service, path_item_one, NULL, &error);
434         g_assert_no_error (error);
435         g_assert (ret == TRUE);
436 }
437
438 static void
439 test_lock_paths_sync (Test *test,
440                       gconstpointer used)
441 {
442         const gchar *collection_path = "/org/freedesktop/secrets/collection/lockone";
443         const gchar *paths[] = {
444                 collection_path,
445                 NULL,
446         };
447
448         GError *error = NULL;
449         gchar **locked = NULL;
450         gboolean ret;
451
452         ret = secret_service_lock_dbus_paths_sync (test->service, paths, NULL, &locked, &error);
453         g_assert_no_error (error);
454         g_assert (ret == TRUE);
455
456         g_assert (locked != NULL);
457         g_assert_cmpstr (locked[0], ==, collection_path);
458         g_assert (locked[1] == NULL);
459         g_strfreev (locked);
460 }
461
462 static void
463 test_lock_prompt_sync (Test *test,
464                        gconstpointer used)
465 {
466         const gchar *collection_path = "/org/freedesktop/secrets/collection/lockprompt";
467         const gchar *paths[] = {
468                 collection_path,
469                 NULL,
470         };
471
472         GError *error = NULL;
473         gchar **locked = NULL;
474         gboolean ret;
475
476         ret = secret_service_lock_dbus_paths_sync (test->service, paths, NULL, &locked, &error);
477         g_assert_no_error (error);
478         g_assert (ret == TRUE);
479
480         g_assert (locked != NULL);
481         g_assert_cmpstr (locked[0], ==, collection_path);
482         g_assert (locked[1] == NULL);
483         g_strfreev (locked);
484 }
485
486 static void
487 test_unlock_paths_sync (Test *test,
488                         gconstpointer used)
489 {
490         const gchar *collection_path = "/org/freedesktop/secrets/collection/lockone";
491         const gchar *paths[] = {
492                 collection_path,
493                 NULL,
494         };
495
496         GError *error = NULL;
497         gchar **unlocked = NULL;
498         gboolean ret;
499
500         ret = secret_service_unlock_dbus_paths_sync (test->service, paths, NULL, &unlocked, &error);
501         g_assert_no_error (error);
502         g_assert (ret == TRUE);
503
504         g_assert (unlocked != NULL);
505         g_assert_cmpstr (unlocked[0], ==, collection_path);
506         g_assert (unlocked[1] == NULL);
507         g_strfreev (unlocked);
508 }
509
510 static void
511 test_unlock_prompt_sync (Test *test,
512                          gconstpointer used)
513 {
514         const gchar *collection_path = "/org/freedesktop/secrets/collection/lockprompt";
515         const gchar *paths[] = {
516                 collection_path,
517                 NULL,
518         };
519
520         GError *error = NULL;
521         gchar **unlocked = NULL;
522         gboolean ret;
523
524         ret = secret_service_unlock_dbus_paths_sync (test->service, paths, NULL, &unlocked, &error);
525         g_assert_no_error (error);
526         g_assert (ret == TRUE);
527
528         g_assert (unlocked != NULL);
529         g_assert_cmpstr (unlocked[0], ==, collection_path);
530         g_assert (unlocked[1] == NULL);
531         g_strfreev (unlocked);
532 }
533
534 static void
535 test_collection_sync (Test *test,
536                       gconstpointer used)
537 {
538         GHashTable *properties;
539         GError *error = NULL;
540         gchar *path;
541
542         properties = g_hash_table_new_full (g_str_hash, g_str_equal, NULL,
543                                             (GDestroyNotify)g_variant_unref);
544         g_hash_table_insert (properties, SECRET_COLLECTION_INTERFACE ".Label",
545                              g_variant_ref_sink (g_variant_new_string ("Wheeee")));
546
547         path = secret_service_create_collection_dbus_path_sync (test->service, properties,
548                                                                 NULL, SECRET_COLLECTION_CREATE_NONE,
549                                                                 NULL, &error);
550
551         g_hash_table_unref (properties);
552
553         g_assert_no_error (error);
554         g_assert (path != NULL);
555         g_assert (g_str_has_prefix (path, "/org/freedesktop/secrets/collection/"));
556
557         g_free (path);
558 }
559
560 static void
561 test_collection_async (Test *test,
562                        gconstpointer used)
563 {
564         GAsyncResult *result = NULL;
565         GHashTable *properties;
566         GError *error = NULL;
567         gchar *path;
568
569         properties = g_hash_table_new_full (g_str_hash, g_str_equal, NULL,
570                                             (GDestroyNotify)g_variant_unref);
571         g_hash_table_insert (properties, SECRET_COLLECTION_INTERFACE ".Label",
572                              g_variant_ref_sink (g_variant_new_string ("Wheeee")));
573
574         secret_service_create_collection_dbus_path (test->service, properties,
575                                                     NULL, SECRET_COLLECTION_CREATE_NONE,
576                                                     NULL, on_complete_get_result, &result);
577
578         g_hash_table_unref (properties);
579         g_assert (result == NULL);
580
581         egg_test_wait ();
582
583         path = secret_service_create_collection_dbus_path_finish (test->service, result, &error);
584         g_object_unref (result);
585
586         g_assert_no_error (error);
587         g_assert (path != NULL);
588         g_assert (g_str_has_prefix (path, "/org/freedesktop/secrets/collection/"));
589
590         g_free (path);
591 }
592
593 static void
594 test_item_sync (Test *test,
595                 gconstpointer used)
596 {
597         const gchar *collection_path = "/org/freedesktop/secrets/collection/english";
598         GHashTable *properties;
599         GHashTable *attributes;
600         SecretValue *value;
601         GError *error = NULL;
602         gchar *path;
603
604         attributes = g_hash_table_new (g_str_hash, g_str_equal);
605         g_hash_table_insert (attributes, "even", "true");
606         g_hash_table_insert (attributes, "string", "ten");
607         g_hash_table_insert (attributes, "number", "10");
608
609         properties = g_hash_table_new_full (g_str_hash, g_str_equal, NULL,
610                                             (GDestroyNotify)g_variant_unref);
611         g_hash_table_insert (properties, SECRET_COLLECTION_INTERFACE ".Label",
612                              g_variant_ref_sink (g_variant_new_string ("Wheeee")));
613         g_hash_table_insert (properties, SECRET_COLLECTION_INTERFACE ".Attributes",
614                              g_variant_ref_sink (_secret_attributes_to_variant (attributes, "org.gnome.Test")));
615
616         g_hash_table_unref (attributes);
617
618         value = secret_value_new ("andmoreandmore", -1, "text/plain");
619
620         path = secret_service_create_item_dbus_path_sync (test->service, collection_path,
621                                                           properties, value, SECRET_ITEM_CREATE_NONE,
622                                                           NULL, &error);
623
624         secret_value_unref (value);
625         g_hash_table_unref (properties);
626
627         g_assert_no_error (error);
628         g_assert (path != NULL);
629         g_assert (g_str_has_prefix (path, collection_path));
630
631         g_free (path);
632 }
633
634 static void
635 test_item_async (Test *test,
636                        gconstpointer used)
637 {
638         const gchar *collection_path = "/org/freedesktop/secrets/collection/english";
639         GHashTable *properties;
640         GHashTable *attributes;
641         SecretValue *value;
642         GError *error = NULL;
643         GAsyncResult *result = NULL;
644         gchar *path;
645
646         attributes = g_hash_table_new (g_str_hash, g_str_equal);
647         g_hash_table_insert (attributes, "even", "true");
648         g_hash_table_insert (attributes, "string", "ten");
649         g_hash_table_insert (attributes, "number", "10");
650
651         properties = g_hash_table_new_full (g_str_hash, g_str_equal, NULL,
652                                             (GDestroyNotify)g_variant_unref);
653         g_hash_table_insert (properties, SECRET_COLLECTION_INTERFACE ".Label",
654                              g_variant_ref_sink (g_variant_new_string ("Wheeee")));
655         g_hash_table_insert (properties, SECRET_COLLECTION_INTERFACE ".Attributes",
656                              g_variant_ref_sink (_secret_attributes_to_variant (attributes, NULL)));
657
658         g_hash_table_unref (attributes);
659
660         value = secret_value_new ("andmoreandmore", -1, "text/plain");
661
662         secret_service_create_item_dbus_path (test->service, collection_path,
663                                               properties, value, SECRET_ITEM_CREATE_NONE,
664                                               NULL, on_complete_get_result, &result);
665
666         g_assert (result == NULL);
667         secret_value_unref (value);
668         g_hash_table_unref (properties);
669
670         egg_test_wait ();
671
672         path = secret_service_create_item_dbus_path_finish (test->service, result, &error);
673         g_object_unref (result);
674
675         g_assert_no_error (error);
676         g_assert (path != NULL);
677         g_assert (g_str_has_prefix (path, collection_path));
678
679         g_free (path);
680 }
681
682 static void
683 test_set_alias_path (Test *test,
684                      gconstpointer used)
685 {
686         gchar *path;
687         GError *error = NULL;
688         gboolean ret;
689
690         path = secret_service_read_alias_dbus_path_sync (test->service, "blah", NULL, &error);
691         g_assert_no_error (error);
692         g_assert (path == NULL);
693
694         ret = secret_service_set_alias_to_dbus_path_sync (test->service, "blah", "/org/freedesktop/secrets/collection/english", NULL, &error);
695         g_assert_no_error (error);
696         g_assert (ret == TRUE);
697
698         path = secret_service_read_alias_dbus_path_sync (test->service, "blah", NULL, &error);
699         g_assert_no_error (error);
700         g_assert_cmpstr (path, ==, "/org/freedesktop/secrets/collection/english");
701         g_free (path);
702
703         ret = secret_service_set_alias_to_dbus_path_sync (test->service, "blah", NULL, NULL, &error);
704         g_assert_no_error (error);
705         g_assert (ret == TRUE);
706
707         path = secret_service_read_alias_dbus_path_sync (test->service, "blah", NULL, &error);
708         g_assert_no_error (error);
709         g_assert (path == NULL);
710 }
711
712 int
713 main (int argc, char **argv)
714 {
715         g_test_init (&argc, &argv, NULL);
716         g_set_prgname ("test-service");
717 #if !GLIB_CHECK_VERSION(2,35,0)
718         g_type_init ();
719 #endif
720
721         g_test_add ("/service/search-for-paths", Test, "mock-service-normal.py", setup, test_search_paths_sync, teardown);
722         g_test_add ("/service/search-for-paths-async", Test, "mock-service-normal.py", setup, test_search_paths_async, teardown);
723         g_test_add ("/service/search-for-paths-nulls", Test, "mock-service-normal.py", setup, test_search_paths_nulls, teardown);
724
725         g_test_add ("/service/secret-for-path-sync", Test, "mock-service-normal.py", setup, test_secret_for_path_sync, teardown);
726         g_test_add ("/service/secret-for-path-plain", Test, "mock-service-only-plain.py", setup, test_secret_for_path_sync, teardown);
727         g_test_add ("/service/secret-for-path-async", Test, "mock-service-normal.py", setup, test_secret_for_path_async, teardown);
728         g_test_add ("/service/secrets-for-paths-sync", Test, "mock-service-normal.py", setup, test_secrets_for_paths_sync, teardown);
729         g_test_add ("/service/secrets-for-paths-async", Test, "mock-service-normal.py", setup, test_secrets_for_paths_async, teardown);
730
731         g_test_add ("/service/delete-for-path", Test, "mock-service-delete.py", setup, test_delete_for_path_sync, teardown);
732         g_test_add ("/service/delete-for-path-with-prompt", Test, "mock-service-delete.py", setup, test_delete_for_path_sync_prompt, teardown);
733
734         g_test_add ("/service/lock-paths-sync", Test, "mock-service-lock.py", setup, test_lock_paths_sync, teardown);
735         g_test_add ("/service/lock-prompt-sync", Test, "mock-service-lock.py", setup, test_lock_prompt_sync, teardown);
736
737         g_test_add ("/service/unlock-paths-sync", Test, "mock-service-lock.py", setup, test_unlock_paths_sync, teardown);
738         g_test_add ("/service/unlock-prompt-sync", Test, "mock-service-lock.py", setup, test_unlock_prompt_sync, teardown);
739
740         g_test_add ("/service/create-collection-sync", Test, "mock-service-normal.py", setup, test_collection_sync, teardown);
741         g_test_add ("/service/create-collection-async", Test, "mock-service-normal.py", setup, test_collection_async, teardown);
742
743         g_test_add ("/service/create-item-sync", Test, "mock-service-normal.py", setup, test_item_sync, teardown);
744         g_test_add ("/service/create-item-async", Test, "mock-service-normal.py", setup, test_item_async, teardown);
745
746         g_test_add ("/service/set-alias-path", Test, "mock-service-normal.py", setup, test_set_alias_path, teardown);
747
748         return egg_tests_run_with_loop ();
749 }