diff options
author | Ross Burton <ross@linux.intel.com> | 2009-04-27 15:57:45 +0100 |
---|---|---|
committer | Ross Burton <ross@linux.intel.com> | 2009-04-27 15:58:39 +0100 |
commit | a75a105a6f8a88a9e8897618c8b64e78fe87bac0 (patch) | |
tree | f0cf37f6b640e2b61f790539c02951bb928b2c8a /tests | |
parent | 78eccb988e3168ea26b91d882983537f296ee80b (diff) | |
download | librest-a75a105a6f8a88a9e8897618c8b64e78fe87bac0.tar.gz |
Update OAuth example and test to new API
Diffstat (limited to 'tests')
-rw-r--r-- | tests/oauth.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/tests/oauth.c b/tests/oauth.c index b7f7531..6ce1219 100644 --- a/tests/oauth.c +++ b/tests/oauth.c @@ -38,27 +38,29 @@ main (int argc, char **argv) /* Create the proxy */ proxy = oauth_proxy_new ("key", "secret", - "http://term.ie/oauth/example/%s", - TRUE); + "http://term.ie/oauth/example/", + FALSE); oproxy = OAUTH_PROXY (proxy); g_assert (oproxy); priv = PROXY_GET_PRIVATE (oproxy); /* First stage authentication, this gets a request token */ - oauth_proxy_auth_step (oproxy, "request_token.php"); + oauth_proxy_auth_step (oproxy, "request_token.php", &error); + g_assert_no_error (error); g_assert_cmpstr (priv->token, ==, "requestkey"); g_assert_cmpstr (priv->token_secret, ==, "requestsecret"); /* Second stage authentication, this gets an access token */ - oauth_proxy_auth_step (OAUTH_PROXY (proxy), "access_token"); + oauth_proxy_auth_step (OAUTH_PROXY (proxy), "access_token", &error); + g_assert_no_error (error); g_assert_cmpstr (priv->token, ==, "accesskey"); g_assert_cmpstr (priv->token_secret, ==, "accesssecret"); /* Make some test calls */ - rest_proxy_bind (proxy, "echo_api.php"); call = rest_proxy_new_call (proxy); + rest_proxy_call_set_function (call, "echo_api.php"); rest_proxy_call_add_param (call, "foo", "bar"); if (!rest_proxy_call_run (call, NULL, &error)) g_error ("Cannot make call: %s", error->message); @@ -66,6 +68,7 @@ main (int argc, char **argv) g_object_unref (call); call = rest_proxy_new_call (proxy); + rest_proxy_call_set_function (call, "echo_api.php"); rest_proxy_call_add_param (call, "numbers", "1234567890"); if (!rest_proxy_call_run (call, NULL, &error)) g_error ("Cannot make call: %s", error->message); @@ -73,6 +76,7 @@ main (int argc, char **argv) g_object_unref (call); call = rest_proxy_new_call (proxy); + rest_proxy_call_set_function (call, "echo_api.php"); rest_proxy_call_add_param (call, "escape", "!£$%^&*()"); if (!rest_proxy_call_run (call, NULL, &error)) g_error ("Cannot make call: %s", error->message); |