[libgdata] picasaweb: Relax some checks in the PicasaWeb test suite



commit c04163c0b53c8a9c0db4650cb345b18374ae8d15
Author: Philip Withnall <philip tecnocode co uk>
Date:   Mon Jul 2 23:48:05 2012 +0100

    picasaweb: Relax some checks in the PicasaWeb test suite
    
    Donât compare ETags and update dates exactly. This fixes some failures caused
    by Googleâs use of relaxed consistency in the server implementation.
    
    Helps: https://bugzilla.gnome.org/show_bug.cgi?id=679072

 gdata/tests/picasaweb.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/gdata/tests/picasaweb.c b/gdata/tests/picasaweb.c
index f1ef39b..8c84c7b 100644
--- a/gdata/tests/picasaweb.c
+++ b/gdata/tests/picasaweb.c
@@ -188,10 +188,12 @@ assert_files_equal (GDataPicasaWebFile *file1, GDataPicasaWebFile *file2, gboole
 	if (compare_inserted_data == TRUE) {
 		g_assert_cmpstr (gdata_entry_get_id (GDATA_ENTRY (file1)), ==, gdata_entry_get_id (GDATA_ENTRY (file2)));
 		g_assert_cmpstr (gdata_entry_get_id (GDATA_ENTRY (file1)), !=, NULL);
-		g_assert_cmpstr (gdata_entry_get_etag (GDATA_ENTRY (file1)), ==, gdata_entry_get_etag (GDATA_ENTRY (file2)));
+		/* Note: We don't check the ETags are equal, because Google like to randomly change ETags without warning. */
 		g_assert_cmpstr (gdata_entry_get_etag (GDATA_ENTRY (file1)), !=, NULL);
-		g_assert_cmpint (gdata_entry_get_updated (GDATA_ENTRY (file1)), ==, gdata_entry_get_updated (GDATA_ENTRY (file2)));
+		g_assert_cmpstr (gdata_entry_get_etag (GDATA_ENTRY (file2)), !=, NULL);
+		/* Same for the updated times. */
 		g_assert_cmpint (gdata_entry_get_updated (GDATA_ENTRY (file1)), >, 0);
+		g_assert_cmpint (gdata_entry_get_updated (GDATA_ENTRY (file2)), >, 0);
 		g_assert_cmpint (gdata_entry_get_published (GDATA_ENTRY (file1)), ==, gdata_entry_get_published (GDATA_ENTRY (file2)));
 		g_assert_cmpint (gdata_entry_get_published (GDATA_ENTRY (file1)), >, 0);
 	}
@@ -228,8 +230,9 @@ assert_files_equal (GDataPicasaWebFile *file1, GDataPicasaWebFile *file2, gboole
 	if (compare_inserted_data == TRUE) {
 		GList *contents1, *contents2, *thumbnails1, *thumbnails2, *i1, *i2;
 
-		g_assert_cmpint (gdata_picasaweb_file_get_edited (file1), ==, gdata_picasaweb_file_get_edited (file2));
+		/* Same as above; don't compare the edited times. */
 		g_assert_cmpint (gdata_picasaweb_file_get_edited (file1), >, 0);
+		g_assert_cmpint (gdata_picasaweb_file_get_edited (file2), >, 0);
 		g_assert_cmpstr (gdata_picasaweb_file_get_version (file1), ==, gdata_picasaweb_file_get_version (file2));
 		g_assert_cmpuint (strlen (gdata_picasaweb_file_get_version (file1)), >, 0);
 		g_assert_cmpstr (gdata_picasaweb_file_get_album_id (file1), ==, gdata_picasaweb_file_get_album_id (file2));



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