[evolution-data-server/openismus-work] test-server-utils: Allow reuse of existing addressbook.
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/openismus-work] test-server-utils: Allow reuse of existing addressbook.
- Date: Thu, 25 Apr 2013 10:31:12 +0000 (UTC)
commit be61c88a3a9dd00c0c92b7af568ec7639767cbd9
Author: Tristan Van Berkom <tristanvb openismus com>
Date: Fri Apr 19 19:48:08 2013 +0900
test-server-utils: Allow reuse of existing addressbook.
If committing the new scratch source ends with an error that
the addressbook/calendar already exists, then just use the existing
source instead of bailing out.
This is needed for tests which reuse the addressbook from a previous test.
tests/test-server-utils/e-test-server-utils.c | 21 ++++++++++++++++++---
1 files changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/tests/test-server-utils/e-test-server-utils.c b/tests/test-server-utils/e-test-server-utils.c
index c4475d8..1d8b9a6 100644
--- a/tests/test-server-utils/e-test-server-utils.c
+++ b/tests/test-server-utils/e-test-server-utils.c
@@ -250,9 +250,24 @@ e_test_server_utils_bootstrap_idle (FixturePair *pair)
if (pair->closure->customize)
pair->closure->customize (scratch, pair->closure);
- if (!e_source_registry_commit_source_sync (pair->fixture->registry, scratch, NULL, &error))
- g_error ("Unable to add new addressbook source to the registry: %s", error->message);
-
+ if (!e_source_registry_commit_source_sync (pair->fixture->registry, scratch, NULL, &error)) {
+ /* Allow sources to carry from one test to the next, if the keep_work_directory
+ * semantics are used then that's what we want (to reuse a source from the
+ * previous test case).
+ */
+ if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_EXISTS)) {
+ ESource *source = e_source_registry_ref_source (pair->fixture->registry,
+ pair->fixture->source_name);
+
+ g_clear_error (&error);
+
+ g_assert (E_IS_SOURCE (source));
+
+ e_test_server_utils_source_added (pair->fixture->registry, source, pair);
+ g_object_unref (source);
+ } else
+ g_error ("Unable to add new addressbook source to the registry: %s",
error->message);
+ }
g_object_unref (scratch);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]