static ETestServerClosure book_closure = { E_TEST_SERVER_ADDRESS_BOOK, NULL, 0 };
static void
+check_removed_contact (EBookClient *book_client,
+ const gchar *uid)
+{
+ GError *error = NULL;
+ EContact *contact = NULL;
+
+ if (e_book_client_get_contact_sync (book_client, uid, &contact, NULL, &error))
+ g_error ("succeeded to fetch removed contact");
+ else if (!g_error_matches (error, E_BOOK_CLIENT_ERROR, E_BOOK_CLIENT_ERROR_CONTACT_NOT_FOUND))
+ g_error ("Wrong error in get contact sync on removed contact: %s (domain: %s, code: %d)",
+ error->message, g_quark_to_string (error->domain), error->code);
+ else
+ g_clear_error (&error);
+}
+
+static void
test_remove_contact_sync (ETestServerFixture *fixture,
gconstpointer user_data)
{
EBookClient *book_client;
GError *error = NULL;
- EContact *contact;
+ EContact *contact = NULL;
gchar *uid;
book_client = E_TEST_SERVER_UTILS_SERVICE (fixture, EBookClient);
g_object_unref (contact);
- if (!e_book_client_get_contact_sync (book_client, uid, &contact, NULL, &error) &&
- g_error_matches (error, E_BOOK_CLIENT_ERROR, E_BOOK_CLIENT_ERROR_CONTACT_NOT_FOUND)) {
- g_clear_error (&error);
- } else
- g_error ("fail with get contact sync on removed contact: %s", error->message);
+ check_removed_contact (book_client, uid);
g_free (uid);
}
{
RemoveData *data = (RemoveData *) user_data;
GError *error = NULL;
- EContact *contact = NULL;
if (!e_book_client_remove_contact_finish (E_BOOK_CLIENT (source_object), result, &error))
g_error ("remove contact finish: %s", error->message);
- if (!e_book_client_get_contact_sync (E_BOOK_CLIENT (source_object), data->uid, &contact, NULL, &error) &&
- g_error_matches (error, E_BOOK_CLIENT_ERROR, E_BOOK_CLIENT_ERROR_CONTACT_NOT_FOUND)) {
- g_clear_error (&error);
- } else
- g_error ("fail with get contact on removed contact: %s", error->message);
+ check_removed_contact (E_BOOK_CLIENT (source_object), data->uid);
g_main_loop_quit (data->loop);
}