[evolution-kolab] test-kolab-mail-access: adapted to KolabMailAccess changes



commit f54f56c2a393324f37d13592e0a92f41e813a0be
Author: Christian Hilberg <hilberg kernelconcepts de>
Date:   Mon Jul 23 20:17:01 2012 +0200

    test-kolab-mail-access: adapted to KolabMailAccess changes
    
    * set a fake KolabSettingsHandler table for sync strategy
      (strategy per-folder not applicable in the testcase, we
      just fall back to the default strategy)
    * added online folder info querying
    * explicitly call kolab_mail_access_synchronize() since
      the synchronization step is now separated out from
      the offline<->online operational mode switching of
      KolabMailAccess

 .../integration/libekolab/test-kolab-mail-access.c |   60 ++++++++++++++++++++
 1 files changed, 60 insertions(+), 0 deletions(-)
---
diff --git a/src/tests/integration/libekolab/test-kolab-mail-access.c b/src/tests/integration/libekolab/test-kolab-mail-access.c
index bd7e6b4..a66e4e9 100644
--- a/src/tests/integration/libekolab/test-kolab-mail-access.c
+++ b/src/tests/integration/libekolab/test-kolab-mail-access.c
@@ -127,6 +127,23 @@ kolab_itest_koma_ksettings_envset (KolabSettingsHandler *ksettings,
 		return FALSE;
 	}
 
+	/* We cannot sanely set a sync strategy for each folder in this testcase
+	 * since we do not want to depend on the server folders. If no strategy
+	 * is set, KolabMailSynchronizer will assume the default. In order to silence
+	 * KolabSettingsHandler's complaints about non-existing tables when requesting
+	 * the sync strategy, we explicitly set the default for the INBOX.
+	 */
+	ok = kolab_settings_handler_set_value (ksettings,
+	                                       KOLAB_SETTINGS_HANDLER_TBL_SYNCSTRATEGY,
+	                                       "INBOX",
+	                                       KOLAB_SYNC_STRATEGY_DEFAULT,
+	                                       &tmp_err);
+
+	if (! ok) {
+		g_propagate_error (err, tmp_err);
+		return FALSE;
+	}
+
 	return TRUE;
 }
 
@@ -242,6 +259,34 @@ test_kolab_mail_access_retrieve_store (KolabMailAccess *kmailaccess,
 }
 
 static gboolean
+test_kolab_mail_access_query_folder_info (KolabMailAccess *kmailaccess,
+                                          GError **err)
+{
+	GList *f_descr = NULL;
+	GList *f_descr_p = NULL;
+	GError *tmp_err = NULL;
+
+	f_descr = kolab_mail_access_query_folder_info_online (kmailaccess,
+	                                                      NULL,
+	                                                      &tmp_err);
+	if (tmp_err != NULL) {
+		g_propagate_error (err, tmp_err);
+		return FALSE;
+	}
+
+	f_descr_p = f_descr;
+	while (f_descr_p != NULL) {
+		g_debug ("%s: ---TYPEINFO--- Folder (%s) ID (%i)",
+		         __func__,
+		         ((KolabFolderDescriptor*)(f_descr_p->data))->name,
+		         ((KolabFolderDescriptor*)(f_descr_p->data))->type_id);
+		f_descr_p = g_list_next (f_descr_p);
+	}
+
+	return TRUE;
+}
+
+static gboolean
 test_kolab_mail_access (KolabFolderContextID context)
 {
 	KolabMailAccess *kmailaccess = NULL;
@@ -300,6 +345,12 @@ test_kolab_mail_access (KolabFolderContextID context)
 	if (! ok)
 		goto test_part_cleanup;
 
+	/* print folder names and type information */
+	ok = test_kolab_mail_access_query_folder_info (kmailaccess,
+	                                               &tmp_err);
+	if (! ok)
+		goto test_part_cleanup;
+
 	/* synchronize metadata and caches with server */
 	ok = kolab_mail_access_synchronize (kmailaccess,
 	                                    NULL, /* all folders */
@@ -316,6 +367,15 @@ test_kolab_mail_access (KolabFolderContextID context)
 	if (! ok)
 		goto test_part_cleanup;
 
+	/* synchronize metadata and caches with server */
+	ok = kolab_mail_access_synchronize (kmailaccess,
+	                                    NULL, /* all folders */
+	                                    TRUE, /* full sync   */
+	                                    NULL,
+	                                    &tmp_err);
+	if (! ok)
+		goto test_part_cleanup;
+
 	/* test operational mode switching online->offline */
 	ok = kolab_mail_access_set_opmode (kmailaccess,
 	                                   KOLAB_MAIL_ACCESS_OPMODE_OFFLINE,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]