[evolution-ews] Bug #695177 - server/tests: fix make check



commit 9588878a8fb9ac190c5224956a356aef25f780e3
Author: Fabiano Fidêncio <fidencio redhat com>
Date:   Mon Mar 4 16:51:09 2013 +0100

    Bug #695177 - server/tests: fix make check
    
    - fix arguments passed e_ews_connection_create_folder
    - fix typo: get_delegate -> info
    - drop deprecated g_thread_init call
    - replace OOFSettings by EEwsOofSettings
    - fix codying style: function_name -> function_name (void)
    - disable getattchaments tests for now (it'll be rewrite in a near future)

 src/server/tests/Makefile.am                       |    4 +-
 src/server/tests/test-autocompletion.c             |    6 +-
 src/server/tests/test-connection.c                 |  101 ++++++++++++++------
 src/server/tests/test-createfolder.c               |   11 +-
 src/server/tests/test-cuditem.c                    |   27 +++---
 src/server/tests/test-deletefolder.c               |    2 +-
 src/server/tests/test-getattachment.c              |   12 +-
 src/server/tests/test-getdelegate.c                |   18 ++--
 src/server/tests/test-libews.c                     |   29 +++---
 ...-get-oof-settings.c => test-oof-settings-new.c} |   25 ++---
 ...t-oof-settings.c => test-oof-settings-submit.c} |   50 +++++-----
 src/server/tests/test-syncfolder.c                 |   12 +-
 12 files changed, 172 insertions(+), 125 deletions(-)
---
diff --git a/src/server/tests/Makefile.am b/src/server/tests/Makefile.am
index 7be8cb4..8ec6fec 100644
--- a/src/server/tests/Makefile.am
+++ b/src/server/tests/Makefile.am
@@ -31,8 +31,8 @@ testews_SOURCES =  \
        test-deletefolder.c \
        test-getdelegate.c \
        test-libews.c  \
-       test-get-oof-settings.c \
-       test-set-oof-settings.c \
+       test-oof-settings-submit.c \
+       test-oof-settings-new.c \
        utils.h \
        $(NULL)
 
diff --git a/src/server/tests/test-autocompletion.c b/src/server/tests/test-autocompletion.c
index 304b932..337540f 100644
--- a/src/server/tests/test-autocompletion.c
+++ b/src/server/tests/test-autocompletion.c
@@ -31,7 +31,7 @@
 
 #include "utils.h"
 
-void autocompletion_tests_run ();
+void autocompletion_tests_run (void);
 
 static GMainLoop *main_loop;
 
@@ -74,7 +74,7 @@ quit:
 }
 
 static void
-op_test_resolve_names ()
+op_test_resolve_names (void)
 {
        const gchar *username;
        const gchar *password;
@@ -115,7 +115,7 @@ idle_cb (gpointer data)
 }
 
 void
-autocompletion_tests_run ()
+autocompletion_tests_run (void)
 {
        g_print ("Testing autocompletion... \n");
 
diff --git a/src/server/tests/test-connection.c b/src/server/tests/test-connection.c
index bf91132..76711c0 100644
--- a/src/server/tests/test-connection.c
+++ b/src/server/tests/test-connection.c
@@ -42,7 +42,7 @@ GMainLoop *main_loop;
 /*Test cases*/
 
 static void
-con_test_create_new_connection ()
+con_test_create_new_connection (void)
 {
        const gchar *username;
        const gchar *password;
@@ -77,40 +77,46 @@ struct _cb_data {
 };
 
 static void
-autodiscover_cb (EwsUrls *urls,
-                 gpointer user_data,
-                 GError *error)
+autodiscover_cb (GObject *object,
+                 GAsyncResult *res,
+                 gpointer user_data)
 {
+       CamelEwsSettings *settings = CAMEL_EWS_SETTINGS (object);
        struct _cb_data *data = (struct _cb_data *) user_data;
        gboolean quit = data->quit;
+       const gchar *host_url, *oab_url;
+       GError *error = NULL;
 
        g_print ("Response for test case : %s \n", data->test_case);
+       e_ews_autodiscover_ws_url_finish (settings, res, &error);
 
-       if (data->positive_case) {
-               g_assert (urls != NULL);
-       } else
-               g_assert (urls == NULL);
+       host_url = camel_ews_settings_get_hosturl (settings);
+       oab_url = camel_ews_settings_get_oaburl (settings);
 
-       if (error)
-               g_print ("Error code:%d desc: %s \n", error->code, error->message);
+       if (data->positive_case)
+               g_assert (host_url != NULL && oab_url != NULL);
+       else
+               g_assert (host_url == NULL || oab_url == NULL);
+
+       if (error != NULL) {
+               g_print ("Error code: %d desc: %s\n", error->code, error->message);
+               g_clear_error (&error);
+       }
+
+       if (host_url || oab_url)
+               g_print ("ASUrl: %s\nOABUrl: %s\n", host_url, oab_url);
 
-       g_clear_error (&error);
        g_free (data->test_case);
        g_free (data);
 
-       if (urls) {
-               g_print ("ASUrl - %s \nOABUrl - %s \n", urls->as_url, urls->oab_url);
-               g_free (urls->as_url);
-               g_free (urls->oab_url);
-       }
-
        if (quit)
                g_main_loop_quit (main_loop);
 }
 
 static void
-con_test_autodiscover ()
+con_test_autodiscover (void)
 {
+       CamelEwsSettings *settings;
        const gchar *username;
        const gchar *password;
        const gchar *email;
@@ -128,38 +134,75 @@ con_test_autodiscover ()
        g_print ("%s %s : password : %s \n", G_STRLOC, G_STRFUNC, password);
        g_print ("%s %s : email : %s \n", G_STRLOC, G_STRFUNC, email);
 
+       settings = g_object_new (
+               CAMEL_TYPE_EWS_SETTINGS,
+               "user", username,
+               NULL);
+       camel_ews_settings_set_hosturl (settings, uri);
+
        user_data = g_new0 (struct _cb_data, 1);
-       user_data->test_case = g_strdup ("postive case... \n");
-       g_print ("Testing %s \n", user_data->test_case);
+       user_data->test_case = g_strdup ("positive case... \n");
        user_data->positive_case = TRUE;
-       e_ews_autodiscover_ws_url (autodiscover_cb, user_data, email, password, NULL, NULL);
+       g_print ("Testing %s \n", user_data->test_case);
+       e_ews_autodiscover_ws_url (
+                       settings,
+                       email,
+                       password,
+                       NULL,
+                       autodiscover_cb,
+                       user_data);
 
        user_data = g_new0 (struct _cb_data, 1);
-       user_data->test_case =  g_strdup ("wrong password... \n");
+       user_data->test_case = g_strdup ("wrong password... \n");
        /* It does respond properly with the url, Check it out */
        user_data->positive_case = TRUE;
        g_print ("Testing %s \n", user_data->test_case);
-       e_ews_autodiscover_ws_url (autodiscover_cb, user_data, email, "wrongpassword", NULL, NULL);
+       e_ews_autodiscover_ws_url (
+                       settings,
+                       email,
+                       "wrongpassword",
+                       NULL,
+                       autodiscover_cb,
+                       user_data);
 
        user_data = g_new0 (struct _cb_data, 1);
        user_data->test_case = g_strdup ("email without domain ... \n");
+       user_data->positive_case = FALSE;
        g_print ("Testing %s \n", user_data->test_case);
-       e_ews_autodiscover_ws_url (autodiscover_cb, user_data, "wronguseremail", password, NULL, NULL);
+       e_ews_autodiscover_ws_url (
+                       settings,
+                       "wronguseremail",
+                       password,
+                       NULL,
+                       autodiscover_cb,
+                       user_data);
 
        user_data = g_new0 (struct _cb_data, 1);
        user_data->test_case = g_strdup ("wrong email address and password... \n");
+       user_data->positive_case = FALSE;
        g_print ("Testing %s \n", user_data->test_case);
-       e_ews_autodiscover_ws_url (autodiscover_cb, user_data, "godknows donknow com", "wrongpassword", NULL, 
NULL);
+       e_ews_autodiscover_ws_url (
+                       settings,
+                       "godknows dontknow com",
+                       "wrongpassword",
+                       NULL,
+                       autodiscover_cb,
+                       user_data);
 
-       user_data->test_case = g_strdup ("wrong user name ... \n");
-       g_print ("Testing %s \n", user_data->test_case);
        domain = g_strstr_len (email, -1, "@");
        wrong_username = g_strconcat ("godknows", domain, NULL);
        user_data = g_new0 (struct _cb_data, 1);
        user_data->test_case = g_strdup ("wrong user name ... \n");
+       user_data->positive_case = TRUE;
        g_print ("Testing %s \n", user_data->test_case);
        user_data->quit = TRUE;
-       e_ews_autodiscover_ws_url (autodiscover_cb, user_data, wrong_username, password, NULL, NULL);
+       e_ews_autodiscover_ws_url (
+                       settings,
+                       wrong_username,
+                       password,
+                       NULL,
+                       autodiscover_cb,
+                       user_data);
        g_free (wrong_username);
 }
 
@@ -176,7 +219,7 @@ idle_cb (gpointer data)
 }
 
 /*Run tests*/
-void connection_tests_run ()
+void connection_tests_run (void)
 {
        g_type_init ();
 
diff --git a/src/server/tests/test-createfolder.c b/src/server/tests/test-createfolder.c
index 795f12d..2963e14 100644
--- a/src/server/tests/test-createfolder.c
+++ b/src/server/tests/test-createfolder.c
@@ -33,7 +33,7 @@
 
 #include "utils.h"
 
-void createfolder_tests_run ();
+void createfolder_tests_run (void);
 
 static GMainLoop *main_loop;
 
@@ -69,7 +69,7 @@ quit:
 }
 
 static void
-op_test_create_folder ()
+op_test_create_folder (void)
 {
        const gchar *username;
        const gchar *password;
@@ -96,9 +96,8 @@ op_test_create_folder ()
 
        e_ews_connection_create_folder (
                cnc, EWS_PRIORITY_MEDIUM, "inbox",
-               TRUE ,"test", cancellable,
-               create_folder_cb, NULL);
-
+               TRUE, "test", E_EWS_FOLDER_TYPE_MAILBOX,
+               cancellable, create_folder_cb, NULL);
 }
 
 static gboolean
@@ -109,7 +108,7 @@ idle_cb (gpointer data)
 }
 
 void
-createfolder_tests_run ()
+createfolder_tests_run (void)
 {
        g_type_init ();
 
diff --git a/src/server/tests/test-cuditem.c b/src/server/tests/test-cuditem.c
index 6eec07f..c75b1de 100644
--- a/src/server/tests/test-cuditem.c
+++ b/src/server/tests/test-cuditem.c
@@ -33,8 +33,8 @@
 
 #include "utils.h"
 
-static void op_test_create_item ();
-void cuditem_tests_run ();
+static void op_test_create_item (void);
+void cuditem_tests_run (void);
 
 static GMainLoop *main_loop;
 
@@ -63,6 +63,10 @@ create_item_ready_callback (GObject *object,
                break;
        }
 
+       e_ews_connection_delete_folder_sync (
+                       cnc, EWS_PRIORITY_MEDIUM,
+                       "evolution-test-folder", TRUE,
+                       "HardDelete", NULL, NULL);
 quit:
        g_main_loop_quit (main_loop);
 }
@@ -88,7 +92,7 @@ op_test_create_item_get_soap_msg (ESoapMessage *msg,
        e_ews_message_write_string_parameter (
                msg, "End", NULL, "2011-03-01T16:00:00");
        e_ews_message_write_string_parameter (
-               msg, "Location", NULL,  "Test Location");
+               msg, "Location", NULL, "Test Location");
 
        e_soap_message_end_element (msg);
 
@@ -100,12 +104,11 @@ op_test_create_item_get_soap_msg (ESoapMessage *msg,
 }
 
 static void
-op_test_create_item ()
+op_test_create_item (void)
 {
        const gchar *username;
        const gchar *password;
        const gchar *uri;
-       const gchar *folderid;
        EEwsConnection *cnc;
        EwsFolderId *fid;
        GCancellable *cancellable;
@@ -127,18 +130,18 @@ op_test_create_item ()
 
        g_object_unref (settings);
 
-       /* to check how to change to real data */
-       fid = e_ews_folder_id_new (
-               
"AQASAG1hbmR5Lnd1QGludGVsLmNvbQAuAAADnUl3sZrICU6Xd1qXV+rpVwEAJvRPgQpR30KhJ7wqBr4YXgAAAY6W+gAAAA==",
-               NULL, FALSE);
+       e_ews_connection_create_folder_sync (
+                       cnc, EWS_PRIORITY_MEDIUM,
+                       "calendar", TRUE,
+                       "evolution-test-folder", E_EWS_FOLDER_TYPE_CALENDAR,
+                       &fid, cancellable, NULL);
 
+       /* to check how to change to real data */
        e_ews_connection_create_items (
                cnc, EWS_PRIORITY_MEDIUM,
                NULL, "SendToAllAndSaveCopy", fid,
                op_test_create_item_get_soap_msg, NULL,
                cancellable, create_item_ready_callback, NULL);
-
-       e_ews_folder_id_free (fid);
 }
 
 static gboolean
@@ -151,7 +154,7 @@ idle_cb (gpointer data)
 }
 
 /*Run tests*/
-void cuditem_tests_run ()
+void cuditem_tests_run (void)
 {
        g_type_init ();
 
diff --git a/src/server/tests/test-deletefolder.c b/src/server/tests/test-deletefolder.c
index f9bf5ec..1396a2b 100644
--- a/src/server/tests/test-deletefolder.c
+++ b/src/server/tests/test-deletefolder.c
@@ -47,7 +47,7 @@ delete_folder_cb (GObject *object,
 
        e_ews_connection_delete_folder_finish (cnc, res, &error);
        if (error != NULL) {
-               g_warning ("Unable to create: %s \n", error->message);
+               g_warning ("Unable to delete: %s \n", error->message);
                g_clear_error (&error);
                goto quit;
        }
diff --git a/src/server/tests/test-getattachment.c b/src/server/tests/test-getattachment.c
index 7f6ee98..2c3486d 100644
--- a/src/server/tests/test-getattachment.c
+++ b/src/server/tests/test-getattachment.c
@@ -33,8 +33,8 @@
 
 #include "utils.h"
 
-static void op_test_get_attachments ();
-void get_attachments_tests_run ();
+static void op_test_get_attachments (void);
+void get_attachments_tests_run (void);
 
 static GMainLoop *main_loop;
 
@@ -64,7 +64,7 @@ quit:
 }
 
 static void
-op_test_get_attachments ()
+op_test_get_attachments (void)
 {
        const gchar *username;
        const gchar *password;
@@ -97,7 +97,7 @@ op_test_get_attachments ()
        attachmentid = 
"AAASAG1hbmR5Lnd1QGludGVsLmNvbQBGAAAAAACdSXexmsgJTpd3WpdX6ulXBwAm9E+BClHfQqEnvCoGvhheAAAAjpb6AACIeDU1D80fTrC3245yXdhOADUAPRB8AAABEgAQADgh/XHkRSZEoCsn9BHi5Fc=";
        ids = g_slist_append (ids, (gpointer *) attachmentid);
 
-       tmpdir = g_build_filename ("/home/xwu1/evo-cache", NULL); //a test directory that exists already
+       tmpdir = g_build_filename (g_get_tmp_dir (), NULL);
 
        e_ews_connection_get_attachments (
                cnc, EWS_PRIORITY_MEDIUM,
@@ -110,14 +110,14 @@ op_test_get_attachments ()
 static gboolean
 idle_cb (gpointer data)
 {
-       g_printf ("Testing get attachments..... \n");
+       g_print ("Testing get attachments..... \n");
        op_test_get_attachments ();
 
        return FALSE;
 }
 
 /*Run tests*/
-void get_attachments_tests_run ()
+void get_attachments_tests_run (void)
 {
        g_type_init ();
 
diff --git a/src/server/tests/test-getdelegate.c b/src/server/tests/test-getdelegate.c
index 0eae7bf..e6cdc45 100644
--- a/src/server/tests/test-getdelegate.c
+++ b/src/server/tests/test-getdelegate.c
@@ -19,7 +19,7 @@
  * USA
  */
 
-/* API : e_ews_connection_create_folders */
+/* API : e_ews_connection_get_delegate */
 
 #include <stdio.h>
 #include <string.h>
@@ -33,7 +33,7 @@
 
 #include "utils.h"
 
-void get_delegate_tests_run ();
+void get_delegate_tests_run (void);
 
 static GMainLoop *main_loop;
 
@@ -60,7 +60,7 @@ get_delegate_cb (GObject *object,
        if (delegates != NULL && delegates->data) {
                EwsDelegateInfo *info = delegates->data;
                if (info->user_id != NULL)
-                       g_print ("Delegate is %s\n", get_delegate->user_id->display_name);
+                       g_print ("Delegate is %s\n", info->user_id->display_name);
        }
 
  quit:
@@ -69,11 +69,12 @@ get_delegate_cb (GObject *object,
 }
 
 static void
-op_test_get_delegate ()
+op_test_get_delegate (void)
 {
        const gchar *username;
        const gchar *password;
        const gchar *uri;
+       const gchar *email;
        EEwsConnection *cnc;
        GCancellable *cancellable;
        CamelEwsSettings *settings;
@@ -94,11 +95,13 @@ op_test_get_delegate ()
 
        g_object_unref (settings);
 
+       util_get_email_from_env (&email);
+       g_assert_cmpstr (email, !=, NULL);
+
        e_ews_connection_get_delegate (
-               cnc, EWS_PRIORITY_MEDIUM, "abc xyz com",
+               cnc, EWS_PRIORITY_MEDIUM, email,
                TRUE, cancellable,
                get_delegate_cb, NULL);
-
 }
 
 static gboolean
@@ -109,10 +112,9 @@ idle_cb (gpointer data)
 }
 
 void
-get_delegate_tests_run ()
+get_delegate_tests_run (void)
 {
        g_type_init ();
-       g_thread_init (NULL);
 
        main_loop = g_main_loop_new (NULL, TRUE);
        g_idle_add ((GSourceFunc) idle_cb, NULL);
diff --git a/src/server/tests/test-libews.c b/src/server/tests/test-libews.c
index 4675d58..70a1198 100644
--- a/src/server/tests/test-libews.c
+++ b/src/server/tests/test-libews.c
@@ -8,19 +8,19 @@
 /* Test result of created folder id */
 extern EwsFolderId *folder_id;
 
-void set_oof_settings_test_run ();
-void get_oof_settings_test_run ();
-void connection_tests_run ();
-void op_tests_run ();
-void cuditem_tests_run ();
-void autocompletion_tests_run ();
-void createfolder_tests_run ();
+void oof_settings_submit_test_run (void);
+void oof_settings_new_test_run (void);
+void connection_tests_run (void);
+void op_tests_run (void);
+void cuditem_tests_run (void);
+void autocompletion_tests_run (void);
+void createfolder_tests_run (void);
 void deletefolder_tests_run (gconstpointer data);
-void get_attachments_tests_run ();
-void get_delegate_tests_run ();
+void get_attachments_tests_run (void);
+void get_delegate_tests_run (void);
 
 static void
-finalize_test_data ()
+finalize_test_data (void)
 {
        if (folder_id) {
                e_ews_folder_id_free (folder_id);
@@ -38,8 +38,8 @@ gint main (gint argc, gchar *argv[])
 
        /*Register tests*/
        g_test_add_func ("/libews/connections", connection_tests_run);
-       g_test_add_func ("/libews/setoofsettings", set_oof_settings_test_run);
-       g_test_add_func ("/libews/getoofsettings", get_oof_settings_test_run);
+       g_test_add_func ("/libews/oofsettingssubmit", oof_settings_submit_test_run);
+       g_test_add_func ("/libews/oofsettingsnew", oof_settings_new_test_run);
        g_test_add_func ("/libews/autocompletion", autocompletion_tests_run);
 
        g_test_add_func ("/libews/syncfolder", op_tests_run);
@@ -50,8 +50,9 @@ gint main (gint argc, gchar *argv[])
 
        g_test_add_func ("/libews/cuditem", cuditem_tests_run);
        g_test_add_func ("/libews/getdelegate", get_delegate_tests_run);
-
-       g_test_add_func ("/libews/getattachment", get_attachments_tests_run);
+       /*
+        * g_test_add_func ("/libews/getattachment", get_attachments_tests_run);
+        */
 
        ret = g_test_run ();
        finalize_test_data ();
diff --git a/src/server/tests/test-get-oof-settings.c b/src/server/tests/test-oof-settings-new.c
similarity index 83%
rename from src/server/tests/test-get-oof-settings.c
rename to src/server/tests/test-oof-settings-new.c
index 2162a3b..6e889ae 100644
--- a/src/server/tests/test-get-oof-settings.c
+++ b/src/server/tests/test-oof-settings-new.c
@@ -19,7 +19,7 @@
  * USA
  */
 
-/* API : e_ews_connection_get_oof_settings */
+/* API : e_ews_oof_settings_new */
 
 #include <stdio.h>
 #include <string.h>
@@ -29,24 +29,21 @@
 
 #include "server/e-ews-connection.h"
 #include "server/e-ews-message.h"
+#include "server/e-ews-oof-settings.h"
 
 #include "utils.h"
 
-void get_oof_settings_test_run ();
+void oof_settings_new_test_run (void);
 static GMainLoop *main_loop;
 
 static void
-get_oof_settings_cb (GObject *object,
+oof_settings_new_cb (GObject *object,
                      GAsyncResult *res,
                      gpointer data)
 {
-       EEwsConnection *cnc = E_EWS_CONNECTION (object);
-       OOFSettings *oof_settings;
        GError *error = NULL;
 
-       e_ews_connection_get_oof_settings_finish (
-               cnc, res, &oof_settings,
-               &error);
+       e_ews_oof_settings_new_finish (res, &error);
        if (error != NULL) {
                g_warning ("Unable to get out of office settings: %s \n", error->message);
                g_clear_error (&error);
@@ -60,7 +57,7 @@ quit:
 }
 
 static void
-op_test_get_oof_settings ()
+op_test_oof_settings_new (void)
 {
        const gchar *username;
        const gchar *password;
@@ -81,7 +78,7 @@ op_test_get_oof_settings ()
 
        settings = g_object_new (
                CAMEL_TYPE_EWS_SETTINGS,
-               "username", username, NULL);
+               "user", username, NULL);
 
        cnc = e_ews_connection_new (uri, settings);
        e_ews_connection_set_password (cnc, password);
@@ -90,20 +87,20 @@ op_test_get_oof_settings ()
 
        e_ews_connection_set_mailbox (cnc, email);
 
-       e_ews_connection_get_oof_settings (
+       e_ews_oof_settings_new (
                cnc, EWS_PRIORITY_MEDIUM, cancellable,
-               get_oof_settings_cb, NULL);
+               oof_settings_new_cb, NULL);
 }
 
 static gboolean
 idle_cb (gpointer data)
 {
-       op_test_get_oof_settings ();
+       op_test_oof_settings_new ();
        return FALSE;
 }
 
 void
-get_oof_settings_test_run ()
+oof_settings_new_test_run (void)
 {
        g_type_init ();
 
diff --git a/src/server/tests/test-set-oof-settings.c b/src/server/tests/test-oof-settings-submit.c
similarity index 69%
rename from src/server/tests/test-set-oof-settings.c
rename to src/server/tests/test-oof-settings-submit.c
index c2f3c67..2d4558c 100644
--- a/src/server/tests/test-set-oof-settings.c
+++ b/src/server/tests/test-oof-settings-submit.c
@@ -19,7 +19,7 @@
  * USA
  */
 
-/* API : e_ews_connection_set_oof_settings */
+/* API : e_ews_oof_settings_submit */
 
 #include <stdio.h>
 #include <string.h>
@@ -29,37 +29,40 @@
 
 #include "server/e-ews-connection.h"
 #include "server/e-ews-message.h"
+#include "server/e-ews-oof-settings.h"
 
 #include "utils.h"
 
-void set_oof_settings_test_run ();
+void oof_settings_submit_test_run (void);
 static GMainLoop *main_loop;
-OOFSettings *oof_settings = NULL;
+EEwsOofSettings *oof_settings = NULL;
 
 static void
-set_arbit_values (void)
+set_arbit_values (EEwsConnection *cnc)
 {
-       time_t tm;
-
-       oof_settings = g_new0 (OOFSettings, 1);
-       oof_settings->state = g_strdup ("Enabled");
-       oof_settings->ext_aud = g_strdup ("All");
-       tm = time (NULL);
-       oof_settings->start_tm = tm - (24 * 60 * 60);
-       oof_settings->end_tm = tm + (24 * 60 * 60);
-       oof_settings->int_reply = g_strdup ("My Internal Reply");
-       oof_settings->ext_reply = g_strdup ("My External Reply");
+       GDateTime *tm = g_date_time_new_now_local ();
+
+       oof_settings = e_ews_oof_settings_new_sync (cnc, NULL, NULL);
+
+       e_ews_oof_settings_set_state (oof_settings, E_EWS_OOF_STATE_ENABLED);
+       e_ews_oof_settings_set_external_audience (oof_settings,
+                       E_EWS_EXTERNAL_AUDIENCE_ALL);
+       e_ews_oof_settings_set_start_time (oof_settings,
+                       g_date_time_add_days (tm, -1));
+       e_ews_oof_settings_set_end_time (oof_settings,
+                       g_date_time_add_days (tm, 1));
+       e_ews_oof_settings_set_internal_reply (oof_settings, "My Internal Reply");
+       e_ews_oof_settings_set_external_reply (oof_settings, "My External Reply");
 }
 
 static void
-set_oof_settings_cb (GObject *object,
+oof_settings_submit_cb (GObject *object,
                      GAsyncResult *res,
                      gpointer data)
 {
-       EEwsConnection *cnc = E_EWS_CONNECTION (object);
        GError *error = NULL;
 
-       e_ews_connection_set_oof_settings_finish (cnc, res, &error);
+       e_ews_oof_settings_submit_finish (E_EWS_OOF_SETTINGS (object), res, &error);
 
        if (error != NULL) {
                g_warning ("Unable to set out of office settings: %s \n", error->message);
@@ -74,7 +77,7 @@ quit:
 }
 
 static void
-op_test_set_oof_settings ()
+op_test_oof_settings_submit (void)
 {
        const gchar *username;
        const gchar *password;
@@ -104,22 +107,21 @@ op_test_set_oof_settings ()
 
        e_ews_connection_set_mailbox (cnc, email);
 
-       set_arbit_values ();
-       e_ews_connection_set_oof_settings (
-               cnc, EWS_PRIORITY_MEDIUM,
+       set_arbit_values (cnc);
+       e_ews_oof_settings_submit (
                oof_settings, cancellable,
-               set_oof_settings_cb, NULL);
+               oof_settings_submit_cb, NULL);
 }
 
 static gboolean
 idle_cb (gpointer data)
 {
-       op_test_set_oof_settings ();
+       op_test_oof_settings_submit ();
        return FALSE;
 }
 
 void
-set_oof_settings_test_run ()
+oof_settings_submit_test_run (void)
 {
        g_type_init ();
 
diff --git a/src/server/tests/test-syncfolder.c b/src/server/tests/test-syncfolder.c
index 420d809..7973a77 100644
--- a/src/server/tests/test-syncfolder.c
+++ b/src/server/tests/test-syncfolder.c
@@ -33,8 +33,8 @@
 
 #include "utils.h"
 
-static void op_test_get_item ();
-void op_tests_run ();
+static void op_test_get_item (void);
+void op_tests_run (void);
 
 GSList *ids;
 EwsFolderId *folder_id;
@@ -90,7 +90,7 @@ folder_items_ready_callback (GObject *object,
 }
 
 static void
-op_test_sync_folder_items ()
+op_test_sync_folder_items (void)
 {
        const gchar *username;
        const gchar *password;
@@ -177,7 +177,7 @@ folder_hierarchy_ready_callback (GObject *object,
 }
 
 static void
-op_test_sync_folder_hierarchy ()
+op_test_sync_folder_hierarchy (void)
 {
        const gchar *username;
        const gchar *password;
@@ -249,7 +249,7 @@ get_item_ready_callback (GObject *object,
 }
 
 static void
-op_test_get_item ()
+op_test_get_item (void)
 {
        const gchar *username;
        const gchar *password;
@@ -295,7 +295,7 @@ idle_cb (gpointer data)
        return FALSE;
 }
 
-void op_tests_run ()
+void op_tests_run (void)
 {
        g_print ("Testing operations... \n");
 


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