diff options
| author | Tristan Van Berkom <tristanvb@openismus.com> | 2013-04-19 19:48:08 +0900 |
|---|---|---|
| committer | Tristan Van Berkom <tristanvb@openismus.com> | 2013-04-23 20:20:46 +0900 |
| commit | 21986669ffde19ffff4813cbf941d0585beff268 (patch) | |
| tree | 3146c069ad4def3c6bed6a046eef92011a2a91fd /tests/test-server-utils | |
| parent | 111d17517af7cbcbae13e8d7a3c5c86f796ef4b8 (diff) | |
| download | evolution-data-server-21986669ffde19ffff4813cbf941d0585beff268.tar.gz | |
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.
Conflicts:
tests/test-server-utils/e-test-server-utils.c
Diffstat (limited to 'tests/test-server-utils')
| -rw-r--r-- | tests/test-server-utils/e-test-server-utils.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/tests/test-server-utils/e-test-server-utils.c b/tests/test-server-utils/e-test-server-utils.c index faefffd25..800a16d46 100644 --- a/tests/test-server-utils/e-test-server-utils.c +++ b/tests/test-server-utils/e-test-server-utils.c @@ -280,8 +280,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); } |
