[evolution-data-server] Add test for EDataCal method 'getLdapAttribute'.



commit d6493f632467c476507972d7c139fc5a2391a47d
Author: Travis Reitter <treitter gmail com>
Date:   Thu Dec 17 09:59:28 2009 -0800

    Add test for EDataCal method 'getLdapAttribute'.

 calendar/tests/ecal/Makefile.am                    |    3 ++
 calendar/tests/ecal/ecal-test-utils.c              |   15 ++++++++++
 calendar/tests/ecal/ecal-test-utils.h              |    3 ++
 calendar/tests/ecal/test-ecal-get-ldap-attribute.c |   28 ++++++++++++++++++++
 4 files changed, 49 insertions(+), 0 deletions(-)
---
diff --git a/calendar/tests/ecal/Makefile.am b/calendar/tests/ecal/Makefile.am
index c6f6401..6c5910e 100644
--- a/calendar/tests/ecal/Makefile.am
+++ b/calendar/tests/ecal/Makefile.am
@@ -36,6 +36,7 @@ TESTS = \
         test-ecal-open				\
         test-ecal-get-alarm-email-address	\
         test-ecal-get-cal-address		\
+        test-ecal-get-ldap-attribute		\
         $(NULL)
 
 # The test program
@@ -50,6 +51,8 @@ test_ecal_get_alarm_email_address_LDADD=$(TEST_ECAL_LIBS)
 test_ecal_get_alarm_email_address_CPPFLAGS=$(TEST_ECAL_CPPFLAGS)
 test_ecal_get_cal_address_LDADD=$(TEST_ECAL_LIBS)
 test_ecal_get_cal_address_CPPFLAGS=$(TEST_ECAL_CPPFLAGS)
+test_ecal_get_ldap_attribute_LDADD=$(TEST_ECAL_LIBS)
+test_ecal_get_ldap_attribute_CPPFLAGS=$(TEST_ECAL_CPPFLAGS)
 test_ecal_open_LDADD=$(TEST_ECAL_LIBS)
 test_ecal_open_CPPFLAGS=$(TEST_ECAL_CPPFLAGS)
 test_ecal_remove_LDADD=$(TEST_ECAL_LIBS)
diff --git a/calendar/tests/ecal/ecal-test-utils.c b/calendar/tests/ecal/ecal-test-utils.c
index 15338bd..1eea7d8 100644
--- a/calendar/tests/ecal/ecal-test-utils.c
+++ b/calendar/tests/ecal/ecal-test-utils.c
@@ -163,3 +163,18 @@ ecal_test_utils_cal_get_cal_address (ECal *cal)
 
 	return address;
 }
+
+char*
+ecal_test_utils_cal_get_ldap_attribute (ECal *cal)
+{
+        GError *error = NULL;
+	char *attr = NULL;
+
+        if (!e_cal_get_ldap_attribute (cal, &attr, &error)) {
+                g_warning ("failed to get ldap attribute; %s\n", error->message);
+                exit(1);
+        }
+        g_print ("successfully got the ldap attribute\n");
+
+	return attr;
+}
diff --git a/calendar/tests/ecal/ecal-test-utils.h b/calendar/tests/ecal/ecal-test-utils.h
index afb7f88..ebcb767 100644
--- a/calendar/tests/ecal/ecal-test-utils.h
+++ b/calendar/tests/ecal/ecal-test-utils.h
@@ -53,4 +53,7 @@ ecal_test_utils_cal_get_alarm_email_address (ECal *cal);
 char*
 ecal_test_utils_cal_get_cal_address (ECal *cal);
 
+char*
+ecal_test_utils_cal_get_ldap_attribute (ECal *cal);
+
 #endif /* _ECAL_TEST_UTILS_H */
diff --git a/calendar/tests/ecal/test-ecal-get-ldap-attribute.c b/calendar/tests/ecal/test-ecal-get-ldap-attribute.c
new file mode 100644
index 0000000..a1758e9
--- /dev/null
+++ b/calendar/tests/ecal/test-ecal-get-ldap-attribute.c
@@ -0,0 +1,28 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <stdlib.h>
+#include <libecal/e-cal.h>
+
+#include "ecal-test-utils.h"
+
+gint
+main (gint argc, gchar **argv)
+{
+	ECal *cal;
+	char *uri = NULL;
+	char *attr;
+
+	g_type_init ();
+
+	cal = ecal_test_utils_cal_new_temp (&uri, E_CAL_SOURCE_TYPE_EVENT);
+	ecal_test_utils_cal_open (cal, FALSE);
+
+	attr = ecal_test_utils_cal_get_ldap_attribute (cal);
+	g_print ("LDAP attribute: '%s'\n", attr);
+
+	ecal_test_utils_cal_remove (cal);
+
+	g_free (attr);
+
+	return 0;
+}



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