ECalClient test test-client-refresh: Only test the refresh APIs if it is supported.
authorTristan Van Berkom <tristanvb@openismus.com>
Wed, 23 Jan 2013 06:33:01 +0000 (15:33 +0900)
committerTristan Van Berkom <tristanvb@openismus.com>
Wed, 23 Jan 2013 06:35:45 +0000 (15:35 +0900)
Newer versions of the local calendar backend dont support the explicit refresh,
so failing the explicit refresh is not an error.

tests/libecal/client/test-client-refresh.c

index b712e46..09fa048 100644 (file)
@@ -5,7 +5,6 @@
 #include <libecal/libecal.h>
 #include <libical/ical.h>
 
-#include "client-test-utils.h"
 #include "e-test-server-utils.h"
 
 static ETestServerClosure cal_closure =
@@ -38,13 +37,17 @@ test_refresh_sync (ETestServerFixture *fixture,
 {
        ECalClient *cal;
        GError *error = NULL;
+       gboolean supported;
 
        cal = E_TEST_SERVER_UTILS_SERVICE (fixture, ECalClient);
 
-       setup_cal (cal);
+       supported = e_client_check_refresh_supported (E_CLIENT (cal));
 
-       g_print ("Refresh supported: %s\n", e_client_check_refresh_supported (E_CLIENT (cal)) ? "yes" : "no");
+       g_print ("Refresh supported: %s\n", supported ? "yes" : "no");
+       if (!supported)
+               return;
 
+       setup_cal (cal);
        if (!e_client_refresh_sync (E_CLIENT (cal), NULL, &error))
                g_error ("refresh sync: %s", error->message);
 }
@@ -71,11 +74,15 @@ test_refresh_async (ETestServerFixture *fixture,
                     gconstpointer user_data)
 {
        ECalClient *cal;
+       gboolean supported;
 
        cal = E_TEST_SERVER_UTILS_SERVICE (fixture, ECalClient);
 
-       setup_cal (cal);
+       supported = e_client_check_refresh_supported (E_CLIENT (cal));
+       if (!supported)
+               return;
 
+       setup_cal (cal);
        e_client_refresh (E_CLIENT (cal), NULL, async_refresh_result_ready, fixture->loop);
        g_main_loop_run (fixture->loop);
 }