[evolution-data-server/openismus-work-master: 1/11] test-ecal-get-objects-for-uid: Fixed assertions in test case.



commit 8c9f6615402bc842a2936146f19a4d1435022314
Author: Tristan Van Berkom <tristanvb openismus com>
Date:   Wed Jan 23 17:49:49 2013 +0900

    test-ecal-get-objects-for-uid: Fixed assertions in test case.
    
    Similar to test-ecal-create-object, this test was comparing a component
    built from scratch (with no UID) against a component fetched from
    the calendar (with a UID).
    
    Fixed test case to compare the components in the returned list against
    a component fetched from the calendar (both with UIDs).

 tests/libecal/test-ecal-get-objects-for-uid.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/tests/libecal/test-ecal-get-objects-for-uid.c b/tests/libecal/test-ecal-get-objects-for-uid.c
index f7b4cd9..b320334 100644
--- a/tests/libecal/test-ecal-get-objects-for-uid.c
+++ b/tests/libecal/test-ecal-get-objects-for-uid.c
@@ -17,6 +17,7 @@ test_get_objects_for_uid (ETestServerFixture *fixture,
 	ECal *cal;
 	icalcomponent *component;
 	icalcomponent *component_final;
+	icalcomponent *component_fetched;
 	ECalComponent *e_component_final;
 	gchar *uid;
 	GList *components;
@@ -26,12 +27,12 @@ test_get_objects_for_uid (ETestServerFixture *fixture,
 	component = icalcomponent_new (ICAL_VEVENT_COMPONENT);
 	uid = ecal_test_utils_cal_create_object (cal, component);
 
-	/* FIXME: In the same way test-ecal-create-object.c,
-	 * this part of the test is broken, need to fix this.
+	/* Assert that we can fetch the newly created component
+	 * and that it's valid
 	 */
-	component_final = ecal_test_utils_cal_get_object (cal, uid);
-	ecal_test_utils_cal_assert_objects_equal_shallow (component, component_final);
-	icalcomponent_free (component_final);
+	component_fetched = ecal_test_utils_cal_get_object (cal, uid);
+	g_assert (component_fetched);
+	g_assert (icalcomponent_is_valid (component_fetched));
 
 	/* The list of component and all subcomponents should just contain the
 	 * component itself (wrapped in an ECalComponent) */
@@ -39,12 +40,13 @@ test_get_objects_for_uid (ETestServerFixture *fixture,
 	g_assert (g_list_length (components) == 1);
 	e_component_final = components->data;
 	component_final = e_cal_component_get_icalcomponent (e_component_final);
-	ecal_test_utils_cal_assert_objects_equal_shallow (component, component_final);
+	ecal_test_utils_cal_assert_objects_equal_shallow (component_fetched, component_final);
 
 	g_list_foreach (components, (GFunc) g_object_unref, NULL);
 	g_list_free (components);
 	g_free (uid);
 	icalcomponent_free (component);
+	icalcomponent_free (component_fetched);
 }
 
 gint



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