[libgdata] documents: Add an XML parsing test for GDataDocumentsFolder
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgdata] documents: Add an XML parsing test for GDataDocumentsFolder
- Date: Sat, 14 Apr 2012 10:42:10 +0000 (UTC)
commit dc298f4f5123ba62df56ae1e4ece08d6055eb2bb
Author: Philip Withnall <philip tecnocode co uk>
Date: Sat Apr 14 11:08:30 2012 +0100
documents: Add an XML parsing test for GDataDocumentsFolder
This includes a test for GDataDocumentsEntry:quota-used.
Helps: https://bugzilla.gnome.org/show_bug.cgi?id=588714
gdata/tests/documents.c | 73 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 73 insertions(+), 0 deletions(-)
---
diff --git a/gdata/tests/documents.c b/gdata/tests/documents.c
index 5c0dc85..dabf1e2 100644
--- a/gdata/tests/documents.c
+++ b/gdata/tests/documents.c
@@ -1273,6 +1273,77 @@ test_access_rule_insert (TempDocumentData *data, gconstpointer service)
}
static void
+test_folder_parser_normal (void)
+{
+ GDataDocumentsFolder *folder;
+ gchar *path;
+ GDataAuthor *author;
+ GError *error = NULL;
+
+ folder = GDATA_DOCUMENTS_FOLDER (gdata_parsable_new_from_xml (GDATA_TYPE_DOCUMENTS_FOLDER,
+ "<?xml version='1.0' encoding='UTF-8'?>"
+ "<entry xmlns='http://www.w3.org/2005/Atom' xmlns:docs='http://schemas.google.com/docs/2007' "
+ "xmlns:batch='http://schemas.google.com/gdata/batch' xmlns:gd='http://schemas.google.com/g/2005' "
+ "gd:etag='"WBYEFh8LRCt7ImBk"'>"
+ "<id>https://docs.google.com/feeds/id/folder%3A0BzY2jgHHwMwYalFhbjhVT3dyams</id>"
+ "<published>2012-04-14T09:12:19.418Z</published>"
+ "<updated>2012-04-14T09:12:19.418Z</updated>"
+ "<app:edited xmlns:app='http://www.w3.org/2007/app'>2012-04-14T09:12:20.055Z</app:edited>"
+ "<category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/docs/2007#folder' label='folder'/>"
+ "<title>Temporary Folder</title>"
+ "<content type='application/atom+xml;type=feed' "
+ "src='https://docs.google.com/feeds/default/private/full/folder%3A0BzY2jgHHwMwYalFhbjhVT3dyams/contents'/>"
+ "<link rel='alternate' type='text/html' href='https://docs.google.com/#folders/folder.0.0BzY2jgHHwMwYalFhbjhVT3dyams'/>"
+ "<link rel='http://schemas.google.com/docs/2007#icon' type='image/png' href='https://ssl.gstatic.com/docs/doclist/images/icon_9_collection_list.png'/>"
+ "<link rel='http://schemas.google.com/g/2005#resumable-create-media' type='application/atom+xml' href='https://docs.google.com/feeds/upload/create-session/default/private/full/folder%3A0BzY2jgHHwMwYalFhbjhVT3dyams/contents'/>"
+ "<link rel='http://schemas.google.com/docs/2007#alt-post' type='application/atom+xml' href='https://docs.google.com/feeds/upload/file/default/private/full/folder%3A0BzY2jgHHwMwYalFhbjhVT3dyams/contents'/>"
+ "<link rel='self' type='application/atom+xml' href='https://docs.google.com/feeds/default/private/full/folder%3A0BzY2jgHHwMwYalFhbjhVT3dyams'/>"
+ "<link rel='edit' type='application/atom+xml' href='https://docs.google.com/feeds/default/private/full/folder%3A0BzY2jgHHwMwYalFhbjhVT3dyams'/>"
+ "<author>"
+ "<name>libgdata.documents</name>"
+ "<email>libgdata documents gmail com</email>"
+ "</author>"
+ "<gd:resourceId>folder:0BzY2jgHHwMwYalFhbjhVT3dyams</gd:resourceId>"
+ "<gd:lastModifiedBy>"
+ "<name>libgdata.documents</name>"
+ "<email>libgdata documents gmail com</email>"
+ "</gd:lastModifiedBy>"
+ "<gd:quotaBytesUsed>0</gd:quotaBytesUsed>"
+ "<docs:writersCanInvite value='false'/>"
+ "<gd:feedLink rel='http://schemas.google.com/acl/2007#accessControlList' href='https://docs.google.com/feeds/default/private/full/folder%3A0BzY2jgHHwMwYalFhbjhVT3dyams/acl'/>"
+ "</entry>", -1, &error));
+ g_assert_no_error (error);
+ g_assert (GDATA_IS_DOCUMENTS_FOLDER (folder));
+ gdata_test_compare_kind (GDATA_ENTRY (folder), "http://schemas.google.com/docs/2007#folder", NULL);
+
+ /* Check IDs. */
+ g_assert_cmpstr (gdata_documents_entry_get_resource_id (GDATA_DOCUMENTS_ENTRY (folder)), ==, "folder:0BzY2jgHHwMwYalFhbjhVT3dyams");
+
+ path = gdata_documents_entry_get_path (GDATA_DOCUMENTS_ENTRY (folder));
+ g_assert_cmpstr (path, ==, "/0BzY2jgHHwMwYalFhbjhVT3dyams");
+ g_free (path);
+
+ /* Check dates. */
+ g_assert_cmpuint (gdata_documents_entry_get_edited (GDATA_DOCUMENTS_ENTRY (folder)), ==, 1334394740);
+ g_assert_cmpuint (gdata_documents_entry_get_last_viewed (GDATA_DOCUMENTS_ENTRY (folder)), ==, -1);
+
+ author = gdata_documents_entry_get_last_modified_by (GDATA_DOCUMENTS_ENTRY (folder));
+
+ g_assert_cmpstr (gdata_author_get_name (author), ==, "libgdata.documents");
+ g_assert_cmpstr (gdata_author_get_uri (author), ==, NULL);
+ g_assert_cmpstr (gdata_author_get_email_address (author), ==, "libgdata documents gmail com");
+
+ /* Check permissions/quotas. */
+ g_assert (gdata_documents_entry_writers_can_invite (GDATA_DOCUMENTS_ENTRY (folder)) == FALSE);
+ g_assert_cmpuint (gdata_documents_entry_get_quota_used (GDATA_DOCUMENTS_ENTRY (folder)), ==, 0);
+
+ /* Check miscellany. */
+ g_assert (gdata_documents_entry_is_deleted (GDATA_DOCUMENTS_ENTRY (folder)) == FALSE);
+
+ g_object_unref (folder);
+}
+
+static void
test_query_etag (void)
{
GDataDocumentsQuery *query = gdata_documents_query_new (NULL);
@@ -1696,6 +1767,8 @@ main (int argc, char *argv[])
tear_down_batch_async);
}
+ g_test_add_func ("/documents/folder/parser/normal", test_folder_parser_normal);
+
g_test_add_func ("/documents/query/etag", test_query_etag);
retval = g_test_run ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]