[libgfbgraph] Some unit tests
- From: Álvaro Peña <alvaropg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgfbgraph] Some unit tests
- Date: Thu, 13 Jun 2013 10:51:02 +0000 (UTC)
commit 5b3b433ba0aeca5e767f276273b49968e5aef02a
Author: Álvaro Peña <alvaropg gmail com>
Date: Thu Jun 13 12:20:44 2013 +0200
Some unit tests
tests/gtestutils.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 46 insertions(+), 1 deletions(-)
---
diff --git a/tests/gtestutils.c b/tests/gtestutils.c
index 0970b3d..7933655 100644
--- a/tests/gtestutils.c
+++ b/tests/gtestutils.c
@@ -4,6 +4,50 @@
#include <gfbgraph/gfbgraph.h>
#include <gfbgraph/gfbgraph-simple-authorizer.h>
+static void
+gfbgraph_test_me_albums (GFBGraphSimpleAuthorizer *authorizer)
+{
+ GFBGraphUser *me;
+ GList *albums = NULL;
+ gint albums_count = 0;
+ GFBGraphAlbum *album;
+ GError *error = NULL;
+
+ me = gfbgraph_user_get_me (GFBGRAPH_AUTHORIZER (authorizer), &error);
+ g_assert_no_error (error);
+ g_assert (GFBGRAPH_IS_USER (me));
+
+ albums = gfbgraph_user_get_albums (GFBGRAPH_USER (me), GFBGRAPH_AUTHORIZER (authorizer), &error);
+ g_assert_no_error (error);
+ /* Just testing one album */
+ while (albums) {
+ album = GFBGRAPH_ALBUM (albums->data);
+ g_assert (GFBGRAPH_IS_ALBUM (album));
+
+ albums = g_list_next (albums);
+ albums_count++;
+ }
+
+ g_list_free_full (albums, g_object_unref);
+ g_object_unref (me);
+
+ if (albums_count == 0) {
+ g_test_fail ();
+ }
+}
+
+static void
+gfbgraph_test_me (GFBGraphSimpleAuthorizer *authorizer)
+{
+ GFBGraphUser *me;
+ GError *error = NULL;
+
+ me = gfbgraph_user_get_me (GFBGRAPH_AUTHORIZER (authorizer), &error);
+ g_assert_no_error (error);
+ g_assert (GFBGRAPH_IS_USER (me));
+
+ g_object_unref (me);
+}
int
main (int argc, char **argv)
@@ -15,7 +59,8 @@ main (int argc, char **argv)
authorizer = gfbgraph_simple_authorizer_new (GFBGRAPH_TEST_ACCESS_TOKEN);
- //g_test_add_data_func ("/GInstapaper/Bookmarks/List", proxy, (GTestDataFunc)
ginstapaper_test_bookmarks_list);
+ g_test_add_data_func ("/GFBGraph/Me", authorizer, (GTestDataFunc) gfbgraph_test_me);
+ g_test_add_data_func ("/GFBGraph/Me/Albums", authorizer, (GTestDataFunc) gfbgraph_test_me_albums);
return g_test_run ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]