[librest] tests/oauth: Bail out if we cannot connect



commit edfdd515460272e4fd9c2244dc3d18f5f8809d9e
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Mon Mar 10 17:15:56 2014 +0000

    tests/oauth: Bail out if we cannot connect
    
    It seems that http://term.ie/oauth/example/ is either down for the
    count, or down for good. In the meantime, let's try to be resilient
    against service outage at least during distcheck.

 tests/oauth-async.c |    6 ++++++
 tests/oauth.c       |    3 +++
 2 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/tests/oauth-async.c b/tests/oauth-async.c
index d6c9a0b..a258127 100644
--- a/tests/oauth-async.c
+++ b/tests/oauth-async.c
@@ -87,6 +87,12 @@ request_token_cb (OAuthProxy   *proxy,
   OAuthProxyPrivate *priv = PROXY_GET_PRIVATE (proxy);
   GError *err = NULL;
 
+  if (error != NULL && g_error_matches (error, REST_PROXY_ERROR, REST_PROXY_ERROR_CONNECTION))
+    {
+      g_main_loop_quit (loop);
+      return;
+    };
+
   g_assert_no_error ((GError *)error);
 
   g_assert_cmpstr (priv->token, ==, "requestkey");
diff --git a/tests/oauth.c b/tests/oauth.c
index eee4fa2..c1db284 100644
--- a/tests/oauth.c
+++ b/tests/oauth.c
@@ -45,6 +45,9 @@ main (int argc, char **argv)
 
   /* First stage authentication, this gets a request token */
   oauth_proxy_request_token (oproxy, "request_token.php", NULL, &error);
+  if (error != NULL && g_error_matches (error, REST_PROXY_ERROR, REST_PROXY_ERROR_CONNECTION))
+    return 0;
+
   g_assert_no_error (error);
   g_assert_cmpstr (priv->token, ==, "requestkey");
   g_assert_cmpstr (priv->token_secret, ==, "requestsecret");


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