[libgdata] tests: Fix batch tests



commit 321fbe1f19184c2b9863c285c803fda120be9a41
Author: Philip Withnall <philip tecnocode co uk>
Date:   Fri Dec 10 10:39:44 2010 +0000

    tests: Fix batch tests
    
    Due to the fixes in GDataBatchOperation which ensure that callbacks are
    always called for every operation, some of the batch operation tests need
    fixing.

 gdata/tests/calendar.c |    7 ++++++-
 gdata/tests/contacts.c |    7 ++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/gdata/tests/calendar.c b/gdata/tests/calendar.c
index fd066d8..ff5455b 100644
--- a/gdata/tests/calendar.c
+++ b/gdata/tests/calendar.c
@@ -970,11 +970,12 @@ test_batch_async_cancellation (BatchAsyncData *data, gconstpointer service)
 	guint op_id;
 	GMainLoop *main_loop;
 	GCancellable *cancellable;
+	GError *error = NULL;
 
 	/* Run an async query operation on the event */
 	operation = gdata_batchable_create_operation (GDATA_BATCHABLE (service), "https://www.google.com/calendar/feeds/default/private/full/batch";);
 	op_id = gdata_test_batch_operation_query (operation, gdata_entry_get_id (GDATA_ENTRY (data->new_event)), GDATA_TYPE_CALENDAR_EVENT,
-	                                          GDATA_ENTRY (data->new_event), NULL, NULL);
+	                                          GDATA_ENTRY (data->new_event), NULL, &error);
 
 	main_loop = g_main_loop_new (NULL, TRUE);
 	cancellable = g_cancellable_new ();
@@ -983,6 +984,10 @@ test_batch_async_cancellation (BatchAsyncData *data, gconstpointer service)
 	g_cancellable_cancel (cancellable); /* this should cancel the operation before it even starts, as we haven't run the main loop yet */
 
 	g_main_loop_run (main_loop);
+
+	g_assert_error (error, G_IO_ERROR, G_IO_ERROR_CANCELLED);
+	g_clear_error (&error);
+
 	g_main_loop_unref (main_loop);
 	g_object_unref (cancellable);
 }
diff --git a/gdata/tests/contacts.c b/gdata/tests/contacts.c
index c8500f0..e18a86c 100644
--- a/gdata/tests/contacts.c
+++ b/gdata/tests/contacts.c
@@ -1812,11 +1812,12 @@ test_batch_async_cancellation (BatchAsyncData *data, gconstpointer service)
 	guint op_id;
 	GMainLoop *main_loop;
 	GCancellable *cancellable;
+	GError *error = NULL;
 
 	/* Run an async query operation on the contact */
 	operation = gdata_batchable_create_operation (GDATA_BATCHABLE (service), "http://www.google.com/m8/feeds/contacts/default/full/batch";);
 	op_id = gdata_test_batch_operation_query (operation, gdata_entry_get_id (GDATA_ENTRY (data->new_contact)), GDATA_TYPE_CONTACTS_CONTACT,
-	                                          GDATA_ENTRY (data->new_contact), NULL, NULL);
+	                                          GDATA_ENTRY (data->new_contact), NULL, &error);
 
 	main_loop = g_main_loop_new (NULL, TRUE);
 	cancellable = g_cancellable_new ();
@@ -1825,6 +1826,10 @@ test_batch_async_cancellation (BatchAsyncData *data, gconstpointer service)
 	g_cancellable_cancel (cancellable); /* this should cancel the operation before it even starts, as we haven't run the main loop yet */
 
 	g_main_loop_run (main_loop);
+
+	g_assert_error (error, G_IO_ERROR, G_IO_ERROR_CANCELLED);
+	g_clear_error (&error);
+
 	g_main_loop_unref (main_loop);
 	g_object_unref (cancellable);
 }



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