Branch data Line data Source code
1 : : /* libsecret - GLib wrapper for Secret Service
2 : : *
3 : : * Copyright 2012 Red Hat Inc.
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 : : * Author: Stef Walter <stefw@gnome.org>
13 : : */
14 : :
15 : :
16 : : #include "config.h"
17 : :
18 : : #undef G_DISABLE_ASSERT
19 : :
20 : : #include "secret-collection.h"
21 : : #include "secret-service.h"
22 : : #include "secret-paths.h"
23 : : #include "secret-private.h"
24 : :
25 : : #include "mock-service.h"
26 : :
27 : : #include "egg/egg-testing.h"
28 : :
29 : : #include <glib.h>
30 : :
31 : : #include <errno.h>
32 : : #include <stdlib.h>
33 : :
34 : : typedef struct {
35 : : SecretService *service;
36 : : } Test;
37 : :
38 : : static const SecretSchema MOCK_SCHEMA = {
39 : : "org.mock.Schema",
40 : : SECRET_SCHEMA_NONE,
41 : : {
42 : : { "number", SECRET_SCHEMA_ATTRIBUTE_INTEGER },
43 : : { "string", SECRET_SCHEMA_ATTRIBUTE_STRING },
44 : : { "even", SECRET_SCHEMA_ATTRIBUTE_BOOLEAN },
45 : : }
46 : : };
47 : :
48 : : static void
49 : 27 : setup (Test *test,
50 : : gconstpointer data)
51 : : {
52 : 27 : GError *error = NULL;
53 : 27 : const gchar *mock_script = data;
54 : :
55 : 27 : mock_service_start (mock_script, &error);
56 [ - + ]: 27 : g_assert_no_error (error);
57 : :
58 : 27 : test->service = secret_service_get_sync (SECRET_SERVICE_NONE, NULL, &error);
59 [ - + ]: 27 : g_assert_no_error (error);
60 : 27 : g_object_add_weak_pointer (G_OBJECT (test->service), (gpointer *)&test->service);
61 : 27 : }
62 : :
63 : : static void
64 : 27 : teardown (Test *test,
65 : : gconstpointer unused)
66 : : {
67 : 27 : g_object_unref (test->service);
68 : 27 : secret_service_disconnect ();
69 [ - + ]: 27 : g_assert_null (test->service);
70 : :
71 : 27 : mock_service_stop ();
72 : 27 : }
73 : :
74 : : static void
75 : 14 : on_async_result (GObject *source,
76 : : GAsyncResult *result,
77 : : gpointer user_data)
78 : : {
79 : 14 : GAsyncResult **ret = user_data;
80 [ - + ]: 14 : g_assert_nonnull (ret);
81 [ - + ]: 14 : g_assert_null (*ret);
82 : 14 : *ret = g_object_ref (result);
83 : 14 : egg_test_wait_stop ();
84 : 14 : }
85 : :
86 : : static void
87 : 2 : on_notify_stop (GObject *obj,
88 : : GParamSpec *spec,
89 : : gpointer user_data)
90 : : {
91 : 2 : guint *sigs = user_data;
92 [ - + ]: 2 : g_assert_nonnull (sigs);
93 [ - + ]: 2 : g_assert_true (*sigs > 0);
94 [ + + ]: 2 : if (--(*sigs) == 0)
95 : 1 : egg_test_wait_stop ();
96 : 2 : }
97 : :
98 : : static void
99 : 1 : test_new_sync (Test *test,
100 : : gconstpointer unused)
101 : : {
102 : 1 : const gchar *collection_path = "/org/freedesktop/secrets/collection/english";
103 : 1 : GError *error = NULL;
104 : : SecretCollection *collection;
105 : :
106 : 1 : collection = secret_collection_new_for_dbus_path_sync (test->service, collection_path,
107 : : SECRET_COLLECTION_NONE, NULL, &error);
108 [ - + ]: 1 : g_assert_no_error (error);
109 : 1 : g_object_add_weak_pointer (G_OBJECT (collection), (gpointer *)&collection);
110 : :
111 [ - + ]: 1 : g_assert_cmpstr (g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection)), ==, collection_path);
112 : :
113 : 1 : g_object_unref (collection);
114 [ - + ]: 1 : g_assert_null (collection);
115 : 1 : }
116 : :
117 : : static void
118 : 1 : test_new_async (Test *test,
119 : : gconstpointer unused)
120 : : {
121 : 1 : const gchar *collection_path = "/org/freedesktop/secrets/collection/english";
122 : 1 : GError *error = NULL;
123 : : SecretCollection *collection;
124 : 1 : GAsyncResult *result = NULL;
125 : :
126 : 1 : secret_collection_new_for_dbus_path (test->service, collection_path,
127 : : SECRET_COLLECTION_NONE, NULL, on_async_result, &result);
128 [ - + ]: 1 : g_assert_null (result);
129 : :
130 [ - + ]: 1 : egg_test_wait ();
131 : :
132 : 1 : collection = secret_collection_new_for_dbus_path_finish (result, &error);
133 [ - + ]: 1 : g_assert_no_error (error);
134 : 1 : g_object_unref (result);
135 : 1 : g_object_add_weak_pointer (G_OBJECT (collection), (gpointer *)&collection);
136 : :
137 [ - + ]: 1 : g_assert_cmpstr (g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection)), ==, collection_path);
138 : :
139 : 1 : g_object_unref (collection);
140 [ - + ]: 1 : g_assert_null (collection);
141 : 1 : }
142 : :
143 : : static void
144 : 1 : test_new_sync_noexist (Test *test,
145 : : gconstpointer unused)
146 : : {
147 : 1 : const gchar *collection_path = "/org/freedesktop/secrets/collection/nonexistant";
148 : 1 : GError *error = NULL;
149 : : SecretCollection *collection;
150 : :
151 : 1 : collection = secret_collection_new_for_dbus_path_sync (test->service, collection_path,
152 : : SECRET_COLLECTION_NONE, NULL, &error);
153 [ + - + - : 1 : g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD);
- + ]
154 [ - + ]: 1 : g_assert_null (collection);
155 : 1 : g_clear_error (&error);
156 : 1 : }
157 : :
158 : : static void
159 : 1 : test_new_async_noexist (Test *test,
160 : : gconstpointer unused)
161 : : {
162 : 1 : const gchar *collection_path = "/org/freedesktop/secrets/collection/nonexistant";
163 : 1 : GError *error = NULL;
164 : : SecretCollection *collection;
165 : 1 : GAsyncResult *result = NULL;
166 : :
167 : 1 : secret_collection_new_for_dbus_path (test->service, collection_path,
168 : : SECRET_COLLECTION_NONE, NULL, on_async_result, &result);
169 [ - + ]: 1 : g_assert_null (result);
170 : :
171 [ - + ]: 1 : egg_test_wait ();
172 : :
173 : 1 : collection = secret_collection_new_for_dbus_path_finish (result, &error);
174 [ + - + - : 1 : g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD);
- + ]
175 [ - + ]: 1 : g_assert_null (collection);
176 : 1 : g_clear_error (&error);
177 : 1 : g_object_unref (result);
178 : 1 : }
179 : :
180 : :
181 : : static void
182 : 1 : test_for_alias_sync (Test *test,
183 : : gconstpointer used)
184 : : {
185 : : const gchar *collection_path;
186 : : SecretCollection *collection;
187 : 1 : GError *error = NULL;
188 : :
189 : 1 : collection = secret_collection_for_alias_sync (test->service, "default",
190 : : SECRET_COLLECTION_NONE, NULL, &error);
191 [ - + ]: 1 : g_assert_no_error (error);
192 : :
193 : 1 : collection_path = g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection));
194 [ - + ]: 1 : g_assert_cmpstr (collection_path, ==, "/org/freedesktop/secrets/collection/english");
195 [ - + ]: 1 : g_assert_cmpuint (secret_collection_get_flags (collection), ==, SECRET_COLLECTION_NONE);
196 [ - + ]: 1 : g_assert_null (secret_collection_get_items (collection));
197 : 1 : g_object_unref (collection);
198 : :
199 : 1 : collection = secret_collection_for_alias_sync (test->service, "unknown",
200 : : SECRET_COLLECTION_NONE, NULL, &error);
201 [ - + ]: 1 : g_assert_no_error (error);
202 [ - + ]: 1 : g_assert_null (collection);
203 : 1 : }
204 : :
205 : : static void
206 : 1 : test_for_alias_async (Test *test,
207 : : gconstpointer used)
208 : : {
209 : : const gchar *collection_path;
210 : : SecretCollection *collection;
211 : 1 : GAsyncResult *result = NULL;
212 : 1 : GError *error = NULL;
213 : :
214 : 1 : secret_collection_for_alias (test->service, "default",
215 : : SECRET_COLLECTION_NONE,
216 : : NULL, on_async_result, &result);
217 [ - + ]: 1 : g_assert_null (result);
218 [ - + ]: 1 : egg_test_wait ();
219 : :
220 : 1 : collection = secret_collection_for_alias_finish (result, &error);
221 [ - + ]: 1 : g_assert_no_error (error);
222 : 1 : g_object_unref (result);
223 : :
224 : 1 : collection_path = g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection));
225 [ - + ]: 1 : g_assert_cmpstr (collection_path, ==, "/org/freedesktop/secrets/collection/english");
226 [ - + ]: 1 : g_assert_cmpuint (secret_collection_get_flags (collection), ==, SECRET_COLLECTION_NONE);
227 [ - + ]: 1 : g_assert_null (secret_collection_get_items (collection));
228 : 1 : g_object_unref (collection);
229 : 1 : result = NULL;
230 : :
231 : 1 : secret_collection_for_alias (test->service, "unknown",
232 : : SECRET_COLLECTION_NONE,
233 : : NULL, on_async_result, &result);
234 [ - + ]: 1 : g_assert_null (result);
235 [ - + ]: 1 : egg_test_wait ();
236 : :
237 : 1 : collection = secret_collection_for_alias_finish (result, &error);
238 [ - + ]: 1 : g_assert_no_error (error);
239 [ - + ]: 1 : g_assert_null (collection);
240 : 1 : g_object_unref (result);
241 : 1 : }
242 : :
243 : : static void
244 : 1 : test_for_alias_load_sync (Test *test,
245 : : gconstpointer used)
246 : : {
247 : : const gchar *collection_path;
248 : : SecretCollection *collection;
249 : 1 : GError *error = NULL;
250 : : GList *items;
251 : :
252 : 1 : collection = secret_collection_for_alias_sync (test->service, "default",
253 : : SECRET_COLLECTION_LOAD_ITEMS,
254 : : NULL, &error);
255 [ - + ]: 1 : g_assert_no_error (error);
256 : :
257 : 1 : collection_path = g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection));
258 [ - + ]: 1 : g_assert_cmpstr (collection_path, ==, "/org/freedesktop/secrets/collection/english");
259 [ - + ]: 1 : g_assert_cmpuint (secret_collection_get_flags (collection), ==, SECRET_COLLECTION_LOAD_ITEMS);
260 : 1 : items = secret_collection_get_items (collection);
261 [ - + ]: 1 : g_assert_nonnull (items);
262 : 1 : g_list_free_full (items, g_object_unref);
263 : 1 : g_object_unref (collection);
264 : 1 : }
265 : :
266 : : static void
267 : 1 : test_for_alias_load_async (Test *test,
268 : : gconstpointer used)
269 : : {
270 : : const gchar *collection_path;
271 : : SecretCollection *collection;
272 : 1 : GAsyncResult *result = NULL;
273 : 1 : GError *error = NULL;
274 : : GList *items;
275 : :
276 : 1 : secret_collection_for_alias (test->service, "default",
277 : : SECRET_COLLECTION_LOAD_ITEMS,
278 : : NULL, on_async_result, &result);
279 [ - + ]: 1 : g_assert_null (result);
280 [ - + ]: 1 : egg_test_wait ();
281 : :
282 : 1 : collection = secret_collection_for_alias_finish (result, &error);
283 [ - + ]: 1 : g_assert_no_error (error);
284 : 1 : g_object_unref (result);
285 : :
286 : 1 : collection_path = g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection));
287 [ - + ]: 1 : g_assert_cmpstr (collection_path, ==, "/org/freedesktop/secrets/collection/english");
288 [ - + ]: 1 : g_assert_cmpuint (secret_collection_get_flags (collection), ==, SECRET_COLLECTION_LOAD_ITEMS);
289 : 1 : items = secret_collection_get_items (collection);
290 [ - + ]: 1 : g_assert_nonnull (items);
291 : 1 : g_list_free_full (items, g_object_unref);
292 : 1 : g_object_unref (collection);
293 : 1 : result = NULL;
294 : 1 : }
295 : :
296 : : #define g_assert_cmpstr_free(str1, op, str2) G_STMT_START { char *str = str1; g_assert_cmpstr (str, op, str2); g_free (str); } G_STMT_END
297 : : static void
298 : 1 : test_create_sync (Test *test,
299 : : gconstpointer unused)
300 : : {
301 : 1 : GError *error = NULL;
302 : : SecretCollection *collection;
303 : :
304 : 1 : collection = secret_collection_create_sync (test->service, "Train", NULL,
305 : : SECRET_COLLECTION_CREATE_NONE, NULL, &error);
306 [ - + ]: 1 : g_assert_no_error (error);
307 : 1 : g_object_add_weak_pointer (G_OBJECT (collection), (gpointer *)&collection);
308 : :
309 [ + - - + : 1 : g_assert_true (g_str_has_prefix (g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection)), "/org/freedesktop/secrets/collection"));
+ - - + ]
310 [ - + ]: 1 : g_assert_cmpstr_free (secret_collection_get_label (collection), ==, "Train");
311 [ - + ]: 1 : g_assert_false (secret_collection_get_locked (collection));
312 : :
313 : 1 : g_object_unref (collection);
314 [ - + ]: 1 : g_assert_null (collection);
315 : 1 : }
316 : :
317 : : static void
318 : 1 : test_create_async (Test *test,
319 : : gconstpointer unused)
320 : : {
321 : 1 : GError *error = NULL;
322 : : SecretCollection *collection;
323 : 1 : GAsyncResult *result = NULL;
324 : :
325 : 1 : secret_collection_create (test->service, "Train", NULL,
326 : : SECRET_COLLECTION_CREATE_NONE,
327 : : NULL, on_async_result, &result);
328 [ - + ]: 1 : g_assert_null (result);
329 : :
330 [ - + ]: 1 : egg_test_wait ();
331 : :
332 : 1 : collection = secret_collection_create_finish (result, &error);
333 [ - + ]: 1 : g_assert_no_error (error);
334 : 1 : g_object_unref (result);
335 : 1 : g_object_add_weak_pointer (G_OBJECT (collection), (gpointer *)&collection);
336 : :
337 [ + - - + : 1 : g_assert_true (g_str_has_prefix (g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection)), "/org/freedesktop/secrets/collection"));
+ - - + ]
338 [ - + ]: 1 : g_assert_cmpstr_free (secret_collection_get_label (collection), ==, "Train");
339 [ - + ]: 1 : g_assert_false (secret_collection_get_locked (collection));
340 : :
341 : 1 : g_object_unref (collection);
342 [ - + ]: 1 : g_assert_null (collection);
343 : 1 : }
344 : :
345 : : static void
346 : 1 : test_properties (Test *test,
347 : : gconstpointer unused)
348 : : {
349 : 1 : const gchar *collection_path = "/org/freedesktop/secrets/collection/english";
350 : : SecretCollection *collection;
351 : : SecretService *service;
352 : 1 : GError *error = NULL;
353 : : guint64 created;
354 : : guint64 modified;
355 : : gboolean locked;
356 : : gchar *label;
357 : :
358 : 1 : collection = secret_collection_new_for_dbus_path_sync (test->service, collection_path,
359 : : SECRET_COLLECTION_NONE, NULL, &error);
360 [ - + ]: 1 : g_assert_no_error (error);
361 : :
362 [ - + ]: 1 : g_assert_false (secret_collection_get_locked (collection));
363 [ - + ]: 1 : g_assert_cmpuint (secret_collection_get_created (collection), <=, time (NULL));
364 [ - + ]: 1 : g_assert_cmpuint (secret_collection_get_modified (collection), <=, time (NULL));
365 : :
366 : 1 : label = secret_collection_get_label (collection);
367 [ - + ]: 1 : g_assert_cmpstr (label, ==, "Collection One");
368 : 1 : g_free (label);
369 : :
370 : 1 : g_object_get (collection,
371 : : "locked", &locked,
372 : : "created", &created,
373 : : "modified", &modified,
374 : : "label", &label,
375 : : "service", &service,
376 : : NULL);
377 : :
378 [ - + ]: 1 : g_assert_false (locked);
379 [ - + ]: 1 : g_assert_cmpuint (created, <=, time (NULL));
380 [ - + ]: 1 : g_assert_cmpuint (modified, <=, time (NULL));
381 : :
382 [ - + ]: 1 : g_assert_cmpstr (label, ==, "Collection One");
383 : 1 : g_free (label);
384 : :
385 [ - + ]: 1 : g_assert_true (service == test->service);
386 : 1 : g_object_unref (service);
387 : :
388 : 1 : g_object_unref (collection);
389 : 1 : }
390 : :
391 : : static void
392 : 6 : check_items_equal (GList *items,
393 : : ...)
394 : : {
395 : : GHashTable *paths;
396 : : gboolean have_item;
397 : : const gchar *path;
398 : : guint num_items;
399 : : va_list va;
400 : : GList *l;
401 : :
402 : 6 : va_start (va, items);
403 : 6 : paths = g_hash_table_new (g_str_hash, g_str_equal);
404 [ + + ]: 12 : while ((path = va_arg (va, gchar *)) != NULL)
405 : 6 : g_hash_table_insert (paths, (gpointer)path, (gpointer)path);
406 : 6 : va_end (va);
407 : :
408 : 6 : num_items = g_hash_table_size (paths);
409 [ - + ]: 6 : g_assert_cmpuint (num_items, ==, g_list_length (items));
410 : :
411 [ + - + + ]: 12 : for (l = items; l != NULL; l = g_list_next (l)) {
412 : 6 : path = g_dbus_proxy_get_object_path (l->data);
413 : 6 : have_item = g_hash_table_remove (paths, path);
414 [ - + ]: 6 : g_assert_true (have_item);
415 : : }
416 : :
417 : 6 : g_hash_table_destroy (paths);
418 : 6 : }
419 : :
420 : : static void
421 : 1 : test_items (Test *test,
422 : : gconstpointer unused)
423 : : {
424 : 1 : const gchar *collection_path = "/org/freedesktop/secrets/collection/english";
425 : : SecretCollection *collection;
426 : 1 : GError *error = NULL;
427 : : GList *items;
428 : :
429 : 1 : collection = secret_collection_new_for_dbus_path_sync (test->service, collection_path,
430 : : SECRET_COLLECTION_LOAD_ITEMS, NULL, &error);
431 [ - + ]: 1 : g_assert_no_error (error);
432 : :
433 : 1 : items = secret_collection_get_items (collection);
434 : 1 : check_items_equal (items,
435 : : "/org/freedesktop/secrets/collection/english/1",
436 : : "/org/freedesktop/secrets/collection/english/2",
437 : : "/org/freedesktop/secrets/collection/english/3",
438 : : NULL);
439 : 1 : g_list_free_full (items, g_object_unref);
440 : :
441 : 1 : g_object_get (collection, "items", &items, NULL);
442 : 1 : check_items_equal (items,
443 : : "/org/freedesktop/secrets/collection/english/1",
444 : : "/org/freedesktop/secrets/collection/english/2",
445 : : "/org/freedesktop/secrets/collection/english/3",
446 : : NULL);
447 : 1 : g_list_free_full (items, g_object_unref);
448 : :
449 : 1 : g_object_unref (collection);
450 : 1 : }
451 : :
452 : : static void
453 : 1 : test_items_empty (Test *test,
454 : : gconstpointer unused)
455 : : {
456 : 1 : const gchar *collection_path = "/org/freedesktop/secrets/collection/empty";
457 : : SecretCollection *collection;
458 : 1 : GError *error = NULL;
459 : : GList *items;
460 : :
461 : 1 : collection = secret_collection_new_for_dbus_path_sync (test->service, collection_path,
462 : : SECRET_COLLECTION_LOAD_ITEMS, NULL, &error);
463 [ - + ]: 1 : g_assert_no_error (error);
464 : :
465 : 1 : items = secret_collection_get_items (collection);
466 : 1 : check_items_equal (items, NULL);
467 : 1 : g_list_free_full (items, g_object_unref);
468 : :
469 : 1 : g_object_get (collection, "items", &items, NULL);
470 : 1 : check_items_equal (items, NULL);
471 : 1 : g_list_free_full (items, g_object_unref);
472 : :
473 : 1 : g_object_unref (collection);
474 : 1 : }
475 : :
476 : : static void
477 : 1 : test_items_empty_async (Test *test,
478 : : gconstpointer unused)
479 : : {
480 : 1 : const gchar *collection_path = "/org/freedesktop/secrets/collection/empty";
481 : : SecretCollection *collection;
482 : 1 : GAsyncResult *result = NULL;
483 : 1 : GError *error = NULL;
484 : : GList *items;
485 : :
486 : 1 : secret_collection_new_for_dbus_path (test->service, collection_path,
487 : : SECRET_COLLECTION_LOAD_ITEMS,
488 : : NULL, on_async_result, &result);
489 [ - + ]: 1 : g_assert_null (result);
490 : :
491 [ - + ]: 1 : egg_test_wait ();
492 : :
493 : 1 : collection = secret_collection_new_for_dbus_path_finish (result, &error);
494 [ - + ]: 1 : g_assert_no_error (error);
495 : 1 : g_object_unref (result);
496 : :
497 : 1 : items = secret_collection_get_items (collection);
498 : 1 : check_items_equal (items, NULL);
499 : 1 : g_list_free_full (items, g_object_unref);
500 : :
501 : 1 : g_object_get (collection, "items", &items, NULL);
502 : 1 : check_items_equal (items, NULL);
503 : 1 : g_list_free_full (items, g_object_unref);
504 : :
505 : 1 : g_object_unref (collection);
506 : 1 : }
507 : :
508 : : static void
509 : 1 : test_set_label_sync (Test *test,
510 : : gconstpointer unused)
511 : : {
512 : 1 : const gchar *collection_path = "/org/freedesktop/secrets/collection/english";
513 : 1 : GError *error = NULL;
514 : : SecretCollection *collection;
515 : : gboolean ret;
516 : : gchar *label;
517 : :
518 : 1 : collection = secret_collection_new_for_dbus_path_sync (test->service, collection_path,
519 : : SECRET_COLLECTION_NONE, NULL, &error);
520 [ - + ]: 1 : g_assert_no_error (error);
521 : :
522 : 1 : label = secret_collection_get_label (collection);
523 [ - + ]: 1 : g_assert_cmpstr (label, ==, "Collection One");
524 : 1 : g_free (label);
525 : :
526 : 1 : ret = secret_collection_set_label_sync (collection, "Another label", NULL, &error);
527 [ - + ]: 1 : g_assert_no_error (error);
528 [ - + ]: 1 : g_assert_true (ret);
529 : :
530 : 1 : label = secret_collection_get_label (collection);
531 [ - + ]: 1 : g_assert_cmpstr (label, ==, "Another label");
532 : 1 : g_free (label);
533 : :
534 : 1 : g_object_unref (collection);
535 : 1 : }
536 : :
537 : : static void
538 : 1 : test_set_label_async (Test *test,
539 : : gconstpointer unused)
540 : : {
541 : 1 : const gchar *collection_path = "/org/freedesktop/secrets/collection/english";
542 : 1 : GAsyncResult *result = NULL;
543 : 1 : GError *error = NULL;
544 : : SecretCollection *collection;
545 : : gboolean ret;
546 : : gchar *label;
547 : :
548 : 1 : collection = secret_collection_new_for_dbus_path_sync (test->service, collection_path,
549 : : SECRET_COLLECTION_NONE, NULL, &error);
550 [ - + ]: 1 : g_assert_no_error (error);
551 : :
552 : 1 : label = secret_collection_get_label (collection);
553 [ - + ]: 1 : g_assert_cmpstr (label, ==, "Collection One");
554 : 1 : g_free (label);
555 : :
556 : 1 : secret_collection_set_label (collection, "Another label", NULL, on_async_result, &result);
557 [ - + ]: 1 : g_assert_null (result);
558 : :
559 [ - + ]: 1 : egg_test_wait ();
560 : :
561 : 1 : ret = secret_collection_set_label_finish (collection, result, &error);
562 [ - + ]: 1 : g_assert_no_error (error);
563 [ - + ]: 1 : g_assert_true (ret);
564 : 1 : g_object_unref (result);
565 : :
566 : 1 : label = secret_collection_get_label (collection);
567 [ - + ]: 1 : g_assert_cmpstr (label, ==, "Another label");
568 : 1 : g_free (label);
569 : :
570 : 1 : g_object_unref (collection);
571 : 1 : }
572 : :
573 : : static void
574 : 1 : test_set_label_prop (Test *test,
575 : : gconstpointer unused)
576 : : {
577 : 1 : const gchar *collection_path = "/org/freedesktop/secrets/collection/english";
578 : 1 : GAsyncResult *result = NULL;
579 : 1 : GError *error = NULL;
580 : : SecretCollection *collection;
581 : 1 : guint sigs = 2;
582 : : gchar *label;
583 : :
584 : 1 : secret_collection_new_for_dbus_path (test->service, collection_path, SECRET_COLLECTION_NONE,
585 : : NULL, on_async_result, &result);
586 [ - + ]: 1 : g_assert_null (result);
587 [ - + ]: 1 : egg_test_wait ();
588 : 1 : collection = secret_collection_new_for_dbus_path_finish (result, &error);
589 [ - + ]: 1 : g_assert_no_error (error);
590 : 1 : g_object_unref (result);
591 : :
592 : 1 : label = secret_collection_get_label (collection);
593 [ - + ]: 1 : g_assert_cmpstr (label, ==, "Collection One");
594 : 1 : g_free (label);
595 : :
596 : 1 : g_signal_connect (collection, "notify::label", G_CALLBACK (on_notify_stop), &sigs);
597 : 1 : g_object_set (collection, "label", "Blah blah", NULL);
598 : :
599 : : /* Wait for the property to actually 'take' */
600 [ - + ]: 1 : egg_test_wait ();
601 : :
602 : 1 : label = secret_collection_get_label (collection);
603 [ - + ]: 1 : g_assert_cmpstr (label, ==, "Blah blah");
604 : 1 : g_free (label);
605 : :
606 : 1 : g_object_unref (collection);
607 : 1 : }
608 : :
609 : : static void
610 : 1 : test_delete_sync (Test *test,
611 : : gconstpointer unused)
612 : : {
613 : 1 : const gchar *collection_path = "/org/freedesktop/secrets/collection/english";
614 : : SecretCollection *collection;
615 : 1 : GError *error = NULL;
616 : : gboolean ret;
617 : :
618 : 1 : collection = secret_collection_new_for_dbus_path_sync (test->service, collection_path,
619 : : SECRET_COLLECTION_NONE, NULL, &error);
620 [ - + ]: 1 : g_assert_no_error (error);
621 : :
622 : 1 : ret = secret_collection_delete_sync (collection, NULL, &error);
623 [ - + ]: 1 : g_assert_no_error (error);
624 [ - + ]: 1 : g_assert_true (ret);
625 : :
626 : 1 : g_object_unref (collection);
627 : :
628 : 1 : collection = secret_collection_new_for_dbus_path_sync (test->service, collection_path,
629 : : SECRET_COLLECTION_NONE, NULL, &error);
630 [ + - + - : 1 : g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD);
- + ]
631 [ - + ]: 1 : g_assert_null (collection);
632 : 1 : g_clear_error (&error);
633 : 1 : }
634 : :
635 : : static void
636 : 1 : test_delete_async (Test *test,
637 : : gconstpointer unused)
638 : : {
639 : 1 : const gchar *collection_path = "/org/freedesktop/secrets/collection/english";
640 : : SecretCollection *collection;
641 : 1 : GAsyncResult *result = NULL;
642 : 1 : GError *error = NULL;
643 : : gboolean ret;
644 : :
645 : 1 : collection = secret_collection_new_for_dbus_path_sync (test->service, collection_path,
646 : : SECRET_COLLECTION_NONE, NULL, &error);
647 [ - + ]: 1 : g_assert_no_error (error);
648 : :
649 : 1 : secret_collection_delete (collection, NULL, on_async_result, &result);
650 [ - + ]: 1 : g_assert_null (result);
651 : :
652 [ - + ]: 1 : egg_test_wait ();
653 : :
654 : 1 : ret = secret_collection_delete_finish (collection, result, &error);
655 [ - + ]: 1 : g_assert_no_error (error);
656 : 1 : g_object_unref (result);
657 [ - + ]: 1 : g_assert_true (ret);
658 : :
659 : 1 : g_object_unref (collection);
660 : :
661 : 1 : collection = secret_collection_new_for_dbus_path_sync (test->service, collection_path,
662 : : SECRET_COLLECTION_NONE, NULL, &error);
663 [ + - + - : 1 : g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD);
- + ]
664 [ - + ]: 1 : g_assert_null (collection);
665 : 1 : g_clear_error(&error);
666 : 1 : }
667 : :
668 : : static void
669 : 1 : test_search_sync (Test *test,
670 : : gconstpointer used)
671 : : {
672 : 1 : const gchar *collection_path = "/org/freedesktop/secrets/collection/english";
673 : : SecretCollection *collection;
674 : : GHashTable *attributes;
675 : 1 : GError *error = NULL;
676 : : GList *items;
677 : :
678 : 1 : collection = secret_collection_new_for_dbus_path_sync (test->service, collection_path,
679 : : SECRET_COLLECTION_NONE, NULL, &error);
680 [ - + ]: 1 : g_assert_no_error (error);
681 : :
682 : 1 : attributes = g_hash_table_new (g_str_hash, g_str_equal);
683 : 1 : g_hash_table_insert (attributes, "number", "1");
684 : :
685 : 1 : items = secret_collection_search_sync (collection, &MOCK_SCHEMA, attributes,
686 : : SECRET_SEARCH_NONE, NULL, &error);
687 [ - + ]: 1 : g_assert_no_error (error);
688 : 1 : g_hash_table_unref (attributes);
689 : :
690 [ - + ]: 1 : g_assert_nonnull (items);
691 [ - + ]: 1 : g_assert_cmpstr (g_dbus_proxy_get_object_path (items->data), ==, "/org/freedesktop/secrets/collection/english/1");
692 : :
693 [ - + ]: 1 : g_assert_null (items->next);
694 : 1 : g_list_free_full (items, g_object_unref);
695 : :
696 : 1 : g_object_unref (collection);
697 : 1 : }
698 : :
699 : : static void
700 : 1 : test_search_async (Test *test,
701 : : gconstpointer used)
702 : : {
703 : 1 : const gchar *collection_path = "/org/freedesktop/secrets/collection/english";
704 : : SecretCollection *collection;
705 : 1 : GAsyncResult *result = NULL;
706 : : GHashTable *attributes;
707 : 1 : GError *error = NULL;
708 : : GList *items;
709 : :
710 : 1 : collection = secret_collection_new_for_dbus_path_sync (test->service, collection_path,
711 : : SECRET_COLLECTION_NONE, NULL, &error);
712 [ - + ]: 1 : g_assert_no_error (error);
713 : :
714 : 1 : attributes = g_hash_table_new (g_str_hash, g_str_equal);
715 : 1 : g_hash_table_insert (attributes, "number", "1");
716 : :
717 : 1 : secret_collection_search (collection, &MOCK_SCHEMA, attributes,
718 : : SECRET_SEARCH_NONE, NULL,
719 : : on_async_result, &result);
720 : 1 : g_hash_table_unref (attributes);
721 [ - + ]: 1 : g_assert_null (result);
722 : :
723 [ - + ]: 1 : egg_test_wait ();
724 : :
725 [ - + + - : 1 : g_assert_true (G_IS_ASYNC_RESULT (result));
- + - + ]
726 : 1 : items = secret_collection_search_finish (collection, result, &error);
727 [ - + ]: 1 : g_assert_no_error (error);
728 : 1 : g_object_unref (result);
729 : :
730 [ - + ]: 1 : g_assert_nonnull (items);
731 [ - + ]: 1 : g_assert_cmpstr (g_dbus_proxy_get_object_path (items->data), ==, "/org/freedesktop/secrets/collection/english/1");
732 : :
733 [ - + ]: 1 : g_assert_null (items->next);
734 : 1 : g_list_free_full (items, g_object_unref);
735 : :
736 : 1 : g_object_unref (collection);
737 : 1 : }
738 : :
739 : : static gint
740 : 5 : sort_by_object_path (gconstpointer a,
741 : : gconstpointer b)
742 : : {
743 : 5 : const gchar *pa = g_dbus_proxy_get_object_path ((GDBusProxy *)a);
744 : 5 : const gchar *pb = g_dbus_proxy_get_object_path ((GDBusProxy *)b);
745 : :
746 : 5 : return g_strcmp0 (pa, pb);
747 : : }
748 : :
749 : : static void
750 : 1 : test_search_all_sync (Test *test,
751 : : gconstpointer used)
752 : : {
753 : 1 : const gchar *collection_path = "/org/freedesktop/secrets/collection/english";
754 : : SecretCollection *collection;
755 : : GHashTable *attributes;
756 : 1 : GError *error = NULL;
757 : : GList *items;
758 : :
759 : 1 : collection = secret_collection_new_for_dbus_path_sync (test->service, collection_path,
760 : : SECRET_COLLECTION_NONE, NULL, &error);
761 [ - + ]: 1 : g_assert_no_error (error);
762 : :
763 : 1 : attributes = g_hash_table_new (g_str_hash, g_str_equal);
764 : :
765 : 1 : items = secret_collection_search_sync (collection, &MOCK_SCHEMA, attributes,
766 : : SECRET_SEARCH_ALL, NULL, &error);
767 [ - + ]: 1 : g_assert_no_error (error);
768 : 1 : g_hash_table_unref (attributes);
769 : :
770 : 1 : items = g_list_sort (items, sort_by_object_path);
771 : :
772 [ - + ]: 1 : g_assert_nonnull (items);
773 [ - + ]: 1 : g_assert_cmpstr (g_dbus_proxy_get_object_path (items->data), ==, "/org/freedesktop/secrets/collection/english/1");
774 [ - + ]: 1 : g_assert_null (secret_item_get_secret (items->data));
775 : :
776 [ - + ]: 1 : g_assert_nonnull (items->next);
777 [ - + ]: 1 : g_assert_cmpstr (g_dbus_proxy_get_object_path (items->next->data), ==, "/org/freedesktop/secrets/collection/english/2");
778 [ - + ]: 1 : g_assert_null (secret_item_get_secret (items->next->data));
779 : :
780 [ - + ]: 1 : g_assert_nonnull (items->next->next);
781 [ - + ]: 1 : g_assert_cmpstr (g_dbus_proxy_get_object_path (items->next->next->data), ==, "/org/freedesktop/secrets/collection/english/3");
782 [ - + ]: 1 : g_assert_null (secret_item_get_secret (items->next->next->data));
783 : :
784 [ - + ]: 1 : g_assert_null (items->next->next->next);
785 : 1 : g_list_free_full (items, g_object_unref);
786 : :
787 : 1 : g_object_unref (collection);
788 : 1 : }
789 : :
790 : : static void
791 : 1 : test_search_all_async (Test *test,
792 : : gconstpointer used)
793 : : {
794 : 1 : const gchar *collection_path = "/org/freedesktop/secrets/collection/english";
795 : : SecretCollection *collection;
796 : 1 : GAsyncResult *result = NULL;
797 : : GHashTable *attributes;
798 : 1 : GError *error = NULL;
799 : : GList *items;
800 : :
801 : 1 : collection = secret_collection_new_for_dbus_path_sync (test->service, collection_path,
802 : : SECRET_COLLECTION_NONE, NULL, &error);
803 [ - + ]: 1 : g_assert_no_error (error);
804 : :
805 : 1 : attributes = g_hash_table_new (g_str_hash, g_str_equal);
806 : :
807 : 1 : secret_collection_search (collection, &MOCK_SCHEMA, attributes,
808 : : SECRET_SEARCH_ALL, NULL,
809 : : on_async_result, &result);
810 : 1 : g_hash_table_unref (attributes);
811 [ - + ]: 1 : g_assert_null (result);
812 : :
813 [ - + ]: 1 : egg_test_wait ();
814 : :
815 [ - + + - : 1 : g_assert_true (G_IS_ASYNC_RESULT (result));
- + - + ]
816 : 1 : items = secret_collection_search_finish (collection, result, &error);
817 [ - + ]: 1 : g_assert_no_error (error);
818 : 1 : g_object_unref (result);
819 : :
820 : 1 : items = g_list_sort (items, sort_by_object_path);
821 : :
822 [ - + ]: 1 : g_assert_nonnull (items);
823 [ - + ]: 1 : g_assert_cmpstr (g_dbus_proxy_get_object_path (items->data), ==, "/org/freedesktop/secrets/collection/english/1");
824 [ - + ]: 1 : g_assert_null (secret_item_get_secret (items->data));
825 : :
826 [ - + ]: 1 : g_assert_nonnull (items->next);
827 [ - + ]: 1 : g_assert_cmpstr (g_dbus_proxy_get_object_path (items->next->data), ==, "/org/freedesktop/secrets/collection/english/2");
828 [ - + ]: 1 : g_assert_null (secret_item_get_secret (items->next->data));
829 : :
830 [ - + ]: 1 : g_assert_nonnull (items->next->next);
831 [ - + ]: 1 : g_assert_cmpstr (g_dbus_proxy_get_object_path (items->next->next->data), ==, "/org/freedesktop/secrets/collection/english/3");
832 [ - + ]: 1 : g_assert_null (secret_item_get_secret (items->next->next->data));
833 : :
834 [ - + ]: 1 : g_assert_null (items->next->next->next);
835 : 1 : g_list_free_full (items, g_object_unref);
836 : :
837 : 1 : g_object_unref (collection);
838 : 1 : }
839 : :
840 : : static void
841 : 1 : test_search_unlock_sync (Test *test,
842 : : gconstpointer used)
843 : : {
844 : 1 : const gchar *collection_path = "/org/freedesktop/secrets/collection/spanish";
845 : : SecretCollection *collection;
846 : : GHashTable *attributes;
847 : 1 : GError *error = NULL;
848 : : GList *items;
849 : :
850 : 1 : collection = secret_collection_new_for_dbus_path_sync (test->service, collection_path,
851 : : SECRET_COLLECTION_NONE, NULL, &error);
852 [ - + ]: 1 : g_assert_no_error (error);
853 : :
854 : 1 : attributes = g_hash_table_new (g_str_hash, g_str_equal);
855 : 1 : g_hash_table_insert (attributes, "number", "1");
856 : :
857 : 1 : items = secret_collection_search_sync (collection, &MOCK_SCHEMA, attributes,
858 : : SECRET_SEARCH_UNLOCK, NULL, &error);
859 [ - + ]: 1 : g_assert_no_error (error);
860 : 1 : g_hash_table_unref (attributes);
861 : :
862 [ - + ]: 1 : g_assert_nonnull (items);
863 [ - + ]: 1 : g_assert_cmpstr (g_dbus_proxy_get_object_path (items->data), ==, "/org/freedesktop/secrets/collection/spanish/10");
864 [ - + ]: 1 : g_assert_false (secret_item_get_locked (items->data));
865 [ - + ]: 1 : g_assert_null (secret_item_get_secret (items->data));
866 : :
867 [ - + ]: 1 : g_assert_null (items->next);
868 : 1 : g_list_free_full (items, g_object_unref);
869 : :
870 : 1 : g_object_unref (collection);
871 : 1 : }
872 : :
873 : : static void
874 : 1 : test_search_unlock_async (Test *test,
875 : : gconstpointer used)
876 : : {
877 : 1 : const gchar *collection_path = "/org/freedesktop/secrets/collection/spanish";
878 : : SecretCollection *collection;
879 : 1 : GAsyncResult *result = NULL;
880 : : GHashTable *attributes;
881 : 1 : GError *error = NULL;
882 : : GList *items;
883 : :
884 : 1 : collection = secret_collection_new_for_dbus_path_sync (test->service, collection_path,
885 : : SECRET_COLLECTION_NONE, NULL, &error);
886 [ - + ]: 1 : g_assert_no_error (error);
887 : :
888 : 1 : attributes = g_hash_table_new (g_str_hash, g_str_equal);
889 : 1 : g_hash_table_insert (attributes, "number", "1");
890 : :
891 : 1 : secret_collection_search (collection, &MOCK_SCHEMA, attributes,
892 : : SECRET_SEARCH_UNLOCK, NULL,
893 : : on_async_result, &result);
894 : 1 : g_hash_table_unref (attributes);
895 [ - + ]: 1 : g_assert_null (result);
896 : :
897 [ - + ]: 1 : egg_test_wait ();
898 : :
899 [ - + + - : 1 : g_assert_true (G_IS_ASYNC_RESULT (result));
- + - + ]
900 : 1 : items = secret_collection_search_finish (collection, result, &error);
901 [ - + ]: 1 : g_assert_no_error (error);
902 : 1 : g_object_unref (result);
903 : :
904 [ - + ]: 1 : g_assert_nonnull (items);
905 [ - + ]: 1 : g_assert_cmpstr (g_dbus_proxy_get_object_path (items->data), ==, "/org/freedesktop/secrets/collection/spanish/10");
906 [ - + ]: 1 : g_assert_false (secret_item_get_locked (items->data));
907 [ - + ]: 1 : g_assert_null (secret_item_get_secret (items->data));
908 : :
909 [ - + ]: 1 : g_assert_null (items->next);
910 : 1 : g_list_free_full (items, g_object_unref);
911 : :
912 : 1 : g_object_unref (collection);
913 : 1 : }
914 : :
915 : : static void
916 : 1 : test_search_secrets_sync (Test *test,
917 : : gconstpointer used)
918 : : {
919 : 1 : const gchar *collection_path = "/org/freedesktop/secrets/collection/english";
920 : : SecretCollection *collection;
921 : : GHashTable *attributes;
922 : 1 : GError *error = NULL;
923 : : SecretValue *value;
924 : : GList *items;
925 : :
926 : 1 : collection = secret_collection_new_for_dbus_path_sync (test->service, collection_path,
927 : : SECRET_COLLECTION_NONE, NULL, &error);
928 [ - + ]: 1 : g_assert_no_error (error);
929 : :
930 : 1 : attributes = g_hash_table_new (g_str_hash, g_str_equal);
931 : 1 : g_hash_table_insert (attributes, "number", "1");
932 : :
933 : 1 : items = secret_collection_search_sync (collection, &MOCK_SCHEMA, attributes,
934 : : SECRET_SEARCH_LOAD_SECRETS,
935 : : NULL, &error);
936 [ - + ]: 1 : g_assert_no_error (error);
937 : 1 : g_hash_table_unref (attributes);
938 : :
939 [ - + ]: 1 : g_assert_nonnull (items);
940 [ - + ]: 1 : g_assert_cmpstr (g_dbus_proxy_get_object_path (items->data), ==, "/org/freedesktop/secrets/collection/english/1");
941 [ - + ]: 1 : g_assert_false (secret_item_get_locked (items->data));
942 : 1 : value = secret_item_get_secret (items->data);
943 [ - + ]: 1 : g_assert_nonnull (value);
944 : 1 : secret_value_unref (value);
945 : :
946 [ - + ]: 1 : g_assert_null (items->next);
947 : 1 : g_list_free_full (items, g_object_unref);
948 : :
949 : 1 : g_object_unref (collection);
950 : 1 : }
951 : :
952 : : static void
953 : 1 : test_search_secrets_async (Test *test,
954 : : gconstpointer used)
955 : : {
956 : 1 : const gchar *collection_path = "/org/freedesktop/secrets/collection/english";
957 : : SecretCollection *collection;
958 : 1 : GAsyncResult *result = NULL;
959 : : GHashTable *attributes;
960 : 1 : GError *error = NULL;
961 : : SecretValue *value;
962 : : GList *items;
963 : :
964 : 1 : collection = secret_collection_new_for_dbus_path_sync (test->service, collection_path,
965 : : SECRET_COLLECTION_NONE, NULL, &error);
966 [ - + ]: 1 : g_assert_no_error (error);
967 : :
968 : 1 : attributes = g_hash_table_new (g_str_hash, g_str_equal);
969 : 1 : g_hash_table_insert (attributes, "number", "1");
970 : :
971 : 1 : secret_collection_search (collection, &MOCK_SCHEMA, attributes,
972 : : SECRET_SEARCH_LOAD_SECRETS, NULL,
973 : : on_async_result, &result);
974 : 1 : g_hash_table_unref (attributes);
975 [ - + ]: 1 : g_assert_null (result);
976 : :
977 [ - + ]: 1 : egg_test_wait ();
978 : :
979 [ - + + - : 1 : g_assert_true (G_IS_ASYNC_RESULT (result));
- + - + ]
980 : 1 : items = secret_collection_search_finish (collection, result, &error);
981 [ - + ]: 1 : g_assert_no_error (error);
982 : 1 : g_object_unref (result);
983 : :
984 [ - + ]: 1 : g_assert_nonnull (items);
985 [ - + ]: 1 : g_assert_cmpstr (g_dbus_proxy_get_object_path (items->data), ==, "/org/freedesktop/secrets/collection/english/1");
986 [ - + ]: 1 : g_assert_false (secret_item_get_locked (items->data));
987 : 1 : value = secret_item_get_secret (items->data);
988 [ - + ]: 1 : g_assert_nonnull (value);
989 : 1 : secret_value_unref (value);
990 : :
991 [ - + ]: 1 : g_assert_null (items->next);
992 : 1 : g_list_free_full (items, g_object_unref);
993 : :
994 : 1 : g_object_unref (collection);
995 : 1 : }
996 : :
997 : : int
998 : 1 : main (int argc, char **argv)
999 : : {
1000 : 1 : g_test_init (&argc, &argv, NULL);
1001 : 1 : g_set_prgname ("test-collection");
1002 : :
1003 : 1 : g_test_add ("/collection/new-sync", Test, "mock-service-normal.py", setup, test_new_sync, teardown);
1004 : 1 : g_test_add ("/collection/new-async", Test, "mock-service-normal.py", setup, test_new_async, teardown);
1005 : 1 : g_test_add ("/collection/new-sync-noexist", Test, "mock-service-normal.py", setup, test_new_sync_noexist, teardown);
1006 : 1 : g_test_add ("/collection/new-async-noexist", Test, "mock-service-normal.py", setup, test_new_async_noexist, teardown);
1007 : 1 : g_test_add ("/collection/for-alias-sync", Test, "mock-service-normal.py", setup, test_for_alias_sync, teardown);
1008 : 1 : g_test_add ("/collection/for-alias-async", Test, "mock-service-normal.py", setup, test_for_alias_async, teardown);
1009 : 1 : g_test_add ("/collection/for-alias-load-sync", Test, "mock-service-normal.py", setup, test_for_alias_load_sync, teardown);
1010 : 1 : g_test_add ("/collection/for-alias-load-async", Test, "mock-service-normal.py", setup, test_for_alias_load_async, teardown);
1011 : 1 : g_test_add ("/collection/create-sync", Test, "mock-service-normal.py", setup, test_create_sync, teardown);
1012 : 1 : g_test_add ("/collection/create-async", Test, "mock-service-normal.py", setup, test_create_async, teardown);
1013 : 1 : g_test_add ("/collection/properties", Test, "mock-service-normal.py", setup, test_properties, teardown);
1014 : 1 : g_test_add ("/collection/items", Test, "mock-service-normal.py", setup, test_items, teardown);
1015 : 1 : g_test_add ("/collection/items-empty", Test, "mock-service-normal.py", setup, test_items_empty, teardown);
1016 : 1 : g_test_add ("/collection/items-empty-async", Test, "mock-service-normal.py", setup, test_items_empty_async, teardown);
1017 : 1 : g_test_add ("/collection/set-label-sync", Test, "mock-service-normal.py", setup, test_set_label_sync, teardown);
1018 : 1 : g_test_add ("/collection/set-label-async", Test, "mock-service-normal.py", setup, test_set_label_async, teardown);
1019 : 1 : g_test_add ("/collection/set-label-prop", Test, "mock-service-normal.py", setup, test_set_label_prop, teardown);
1020 : 1 : g_test_add ("/collection/delete-sync", Test, "mock-service-normal.py", setup, test_delete_sync, teardown);
1021 : 1 : g_test_add ("/collection/delete-async", Test, "mock-service-normal.py", setup, test_delete_async, teardown);
1022 : :
1023 : 1 : g_test_add ("/collection/search-sync", Test, "mock-service-normal.py", setup, test_search_sync, teardown);
1024 : 1 : g_test_add ("/collection/search-async", Test, "mock-service-normal.py", setup, test_search_async, teardown);
1025 : 1 : g_test_add ("/collection/search-all-sync", Test, "mock-service-normal.py", setup, test_search_all_sync, teardown);
1026 : 1 : g_test_add ("/collection/search-all-async", Test, "mock-service-normal.py", setup, test_search_all_async, teardown);
1027 : 1 : g_test_add ("/collection/search-unlock-sync", Test, "mock-service-normal.py", setup, test_search_unlock_sync, teardown);
1028 : 1 : g_test_add ("/collection/search-unlock-async", Test, "mock-service-normal.py", setup, test_search_unlock_async, teardown);
1029 : 1 : g_test_add ("/collection/search-secrets-sync", Test, "mock-service-normal.py", setup, test_search_secrets_sync, teardown);
1030 : 1 : g_test_add ("/collection/search-secrets-async", Test, "mock-service-normal.py", setup, test_search_secrets_async, teardown);
1031 : :
1032 : 1 : return egg_tests_run_with_loop ();
1033 : : }
|