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