diff options
author | Álvaro Peña <alvaropg@gmail.com> | 2014-04-14 20:13:49 +0200 |
---|---|---|
committer | Álvaro Peña <alvaropg@gmail.com> | 2014-04-14 20:13:49 +0200 |
commit | 81c3475a67713e413e5660e5efc1b9a250a9fc61 (patch) | |
tree | b0a6b743d718f62a09a41fe0b3b9d936c56f7792 | |
parent | 7367e04bbb65bc5e6329a13d75b4c210af5fe305 (diff) | |
download | libgfbgraph-81c3475a67713e413e5660e5efc1b9a250a9fc61.tar.gz |
GTest: Improved "Me" test with the test user email
-rw-r--r-- | tests/gtestutils.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/gtestutils.c b/tests/gtestutils.c index 1428095..5c81104 100644 --- a/tests/gtestutils.c +++ b/tests/gtestutils.c @@ -1,7 +1,7 @@ /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8; tab-width: 8 -*- */ /* * libgfbgraph - GObject library for Facebook Graph API - * Copyright (C) 2013 Álvaro Peña <alvaropg@gmail.com> + * Copyright (C) 2013-2014 Álvaro Peña <alvaropg@gmail.com> * * GFBGraph is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -32,6 +32,7 @@ typedef struct _GFBGraphTestApp GFBGraphTestApp; struct _GFBGraphTestFixture { gchar *user_id; + gchar *user_email; GFBGraphSimpleAuthorizer *authorizer; }; @@ -45,6 +46,8 @@ struct _GFBGraphTestApp #define FACEBOOK_ENDPOINT "https://graph.facebook.com" +#define FACEBOOK_TEST_USER_PERMISSIONS "user_about_me,user_photos,email" + GFBGraphTestApp* gfbgraph_test_app_setup (void) { @@ -122,7 +125,7 @@ gfbgraph_test_fixture_setup (GFBGraphTestFixture *fixture, gconstpointer user_da /* Params as documented here: https://developers.facebook.com/docs/graph-api/reference/app/accounts/test-users#publish */ rest_proxy_call_add_param (rest_call, "installed", "true"); - rest_proxy_call_add_param (rest_call, "permissions", "user_about_me,user_photos"); + rest_proxy_call_add_param (rest_call, "permissions", FACEBOOK_TEST_USER_PERMISSIONS); rest_proxy_call_add_param (rest_call, "access_token", app->access_token); rest_proxy_call_set_method (rest_call, "POST"); @@ -145,6 +148,9 @@ gfbgraph_test_fixture_setup (GFBGraphTestFixture *fixture, gconstpointer user_da json_reader_read_element (jreader, 1); access_token = g_strdup (json_reader_get_string_value (jreader)); json_reader_end_element (jreader); + json_reader_read_element (jreader, 3); + fixture->user_email = g_strdup (json_reader_get_string_value (jreader)); + json_reader_end_element (jreader); fixture->authorizer = gfbgraph_simple_authorizer_new (access_token); @@ -178,6 +184,7 @@ gfbgraph_test_fixture_teardown (GFBGraphTestFixture *fixture, gconstpointer user g_free (function_path); g_free (auth_value); g_free (fixture->user_id); + g_free (fixture->user_email); g_object_unref (fixture->authorizer); } @@ -193,6 +200,8 @@ gfbgraph_test_me (GFBGraphTestFixture *fixture, gconstpointer user_data) g_assert_cmpstr (fixture->user_id, ==, gfbgraph_node_get_id (GFBGRAPH_NODE (me))); + g_assert_cmpstr (fixture->user_email, ==, gfbgraph_user_get_email (me)); + g_object_unref (me); } |