[libgdata] calendar: Split access rule XML tests out from the insertion test
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgdata] calendar: Split access rule XML tests out from the insertion test
- Date: Sat, 2 Jul 2011 18:27:40 +0000 (UTC)
commit fbfcd0adacaed515dff69c0904806ba0ed88b7f8
Author: Philip Withnall <philip tecnocode co uk>
Date: Sat Jul 2 18:53:18 2011 +0100
calendar: Split access rule XML tests out from the insertion test
Helps: bgo#633359
gdata/tests/calendar.c | 60 ++++++++++++++++++++++++++++++++++-------------
1 files changed, 43 insertions(+), 17 deletions(-)
---
diff --git a/gdata/tests/calendar.c b/gdata/tests/calendar.c
index cff72f5..0dcd8a8 100644
--- a/gdata/tests/calendar.c
+++ b/gdata/tests/calendar.c
@@ -891,6 +891,46 @@ test_event_escaping (void)
}
static void
+test_access_rule_properties (void)
+{
+ GDataAccessRule *rule;
+ const gchar *scope_type, *scope_value;
+
+ rule = gdata_access_rule_new (NULL);
+
+ gdata_access_rule_set_role (rule, GDATA_CALENDAR_ACCESS_ROLE_EDITOR);
+ g_assert_cmpstr (gdata_access_rule_get_role (rule), ==, GDATA_CALENDAR_ACCESS_ROLE_EDITOR);
+
+ gdata_access_rule_set_scope (rule, GDATA_ACCESS_SCOPE_USER, "darcy gmail com");
+ gdata_access_rule_get_scope (rule, &scope_type, &scope_value);
+ g_assert_cmpstr (scope_type, ==, GDATA_ACCESS_SCOPE_USER);
+ g_assert_cmpstr (scope_value, ==, "darcy gmail com");
+}
+
+static void
+test_access_rule_xml (void)
+{
+ GDataAccessRule *rule;
+
+ rule = gdata_access_rule_new (NULL);
+
+ gdata_access_rule_set_role (rule, GDATA_CALENDAR_ACCESS_ROLE_EDITOR);
+ gdata_access_rule_set_scope (rule, GDATA_ACCESS_SCOPE_USER, "darcy gmail com");
+
+ /* Check the XML */
+ gdata_test_assert_xml (rule,
+ "<?xml version='1.0' encoding='UTF-8'?>"
+ "<entry xmlns='http://www.w3.org/2005/Atom' "
+ "xmlns:gd='http://schemas.google.com/g/2005' "
+ "xmlns:gAcl='http://schemas.google.com/acl/2007'>"
+ "<title type='text'>http://schemas.google.com/gCal/2005#editor</title>"
+ "<category term='http://schemas.google.com/acl/2007#accessRule' scheme='http://schemas.google.com/g/2005#kind'/>"
+ "<gAcl:role value='http://schemas.google.com/gCal/2005#editor'/>"
+ "<gAcl:scope type='user' value='darcy gmail com'/>"
+ "</entry>");
+}
+
+static void
test_query_uri (void)
{
gint64 _time;
@@ -1034,24 +1074,7 @@ test_acls_insert_rule (gconstpointer service)
rule = gdata_access_rule_new (NULL);
gdata_access_rule_set_role (rule, GDATA_CALENDAR_ACCESS_ROLE_EDITOR);
- g_assert_cmpstr (gdata_access_rule_get_role (rule), ==, GDATA_CALENDAR_ACCESS_ROLE_EDITOR);
-
gdata_access_rule_set_scope (rule, GDATA_ACCESS_SCOPE_USER, "darcy gmail com");
- gdata_access_rule_get_scope (rule, &scope_type, &scope_value);
- g_assert_cmpstr (scope_type, ==, GDATA_ACCESS_SCOPE_USER);
- g_assert_cmpstr (scope_value, ==, "darcy gmail com");
-
- /* Check the XML */
- gdata_test_assert_xml (rule,
- "<?xml version='1.0' encoding='UTF-8'?>"
- "<entry xmlns='http://www.w3.org/2005/Atom' "
- "xmlns:gd='http://schemas.google.com/g/2005' "
- "xmlns:gAcl='http://schemas.google.com/acl/2007'>"
- "<title type='text'>http://schemas.google.com/gCal/2005#editor</title>"
- "<category term='http://schemas.google.com/acl/2007#accessRule' scheme='http://schemas.google.com/g/2005#kind'/>"
- "<gAcl:role value='http://schemas.google.com/gCal/2005#editor'/>"
- "<gAcl:scope type='user' value='darcy gmail com'/>"
- "</entry>");
/* Insert the rule */
_link = gdata_entry_look_up_link (GDATA_ENTRY (calendar), GDATA_LINK_ACCESS_CONTROL_LIST);
@@ -1480,6 +1503,9 @@ main (int argc, char *argv[])
g_test_add_func ("/calendar/calendar/escaping", test_calendar_escaping);
g_test_add_func ("/calendar/event/escaping", test_event_escaping);
+ g_test_add_func ("/calendar/access-rule/properties", test_access_rule_properties);
+ g_test_add_func ("/calendar/access-rule/xml", test_access_rule_xml);
+
g_test_add_func ("/calendar/query/uri", test_query_uri);
g_test_add_func ("/calendar/query/etag", test_query_etag);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]