[libgdata] tests: Fix GDataAuthorizer:proxy-resolver property tests



commit e16460a3992fc6cb2f44c3b7ff25cdc2ab4c10a9
Author: Philip Withnall <philip tecnocode co uk>
Date:   Sat Aug 9 16:33:12 2014 +0100

    tests: Fix GDataAuthorizer:proxy-resolver property tests
    
    The ClientLogin and OAuth 1 authoriser tests were assuming that the
    proxy-resolver property is initially NULL. Actually, the property is
    only potentially initially NULL, as it comes from a SoupSession which
    the tests have no control over.

 gdata/tests/client-login-authorizer.c |   11 ++++++-----
 gdata/tests/oauth1-authorizer.c       |    9 +++++----
 2 files changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/gdata/tests/client-login-authorizer.c b/gdata/tests/client-login-authorizer.c
index 9b37a04..515df21 100644
--- a/gdata/tests/client-login-authorizer.c
+++ b/gdata/tests/client-login-authorizer.c
@@ -203,13 +203,14 @@ test_client_login_authorizer_properties_password (ClientLoginAuthorizerData *dat
 static void
 test_client_login_authorizer_properties_proxy_resolver (ClientLoginAuthorizerData *data, gconstpointer 
user_data)
 {
-       GProxyResolver *proxy_resolver, *new_proxy_resolver;
+       GProxyResolver *old_proxy_resolver, *proxy_resolver, *new_proxy_resolver;
 
-       /* Verifying the normal state of the property in a newly-constructed instance of 
GDataClientLoginAuthorizer */
-       g_assert (gdata_client_login_authorizer_get_proxy_resolver (data->authorizer) == NULL);
+       /* Verifying the normal state of the property in a newly-constructed instance of 
GDataClientLoginAuthorizer.
+        * Since the resolver comes from the SoupSession, we don’t know whether it’s initially NULL. */
+       old_proxy_resolver = gdata_client_login_authorizer_get_proxy_resolver (data->authorizer);
 
        g_object_get (data->authorizer, "proxy-resolver", &proxy_resolver, NULL);
-       g_assert (proxy_resolver == NULL);
+       g_assert (proxy_resolver == old_proxy_resolver);
 
        g_assert_cmpuint (data->proxy_resolver_notification_count, ==, 0);
 
@@ -229,7 +230,7 @@ test_client_login_authorizer_properties_proxy_resolver (ClientLoginAuthorizerDat
 
        g_object_unref (new_proxy_resolver);
 
-       /* Check setting it back to NULL works */
+       /* Check setting it to NULL works */
        gdata_client_login_authorizer_set_proxy_resolver (data->authorizer, NULL);
 
        g_assert_cmpuint (data->proxy_resolver_notification_count, ==, 2);
diff --git a/gdata/tests/oauth1-authorizer.c b/gdata/tests/oauth1-authorizer.c
index e5025e4..30470ca 100644
--- a/gdata/tests/oauth1-authorizer.c
+++ b/gdata/tests/oauth1-authorizer.c
@@ -290,13 +290,14 @@ test_oauth1_authorizer_properties_locale (OAuth1AuthorizerData *data, gconstpoin
 static void
 test_oauth1_authorizer_properties_proxy_resolver (OAuth1AuthorizerData *data, gconstpointer user_data)
 {
-       GProxyResolver *proxy_resolver, *new_proxy_resolver;
+       GProxyResolver *old_proxy_resolver, *proxy_resolver, *new_proxy_resolver;
 
-       /* Verifying the normal state of the property in a newly-constructed instance of 
GDataOAuth1Authorizer */
-       g_assert (gdata_oauth1_authorizer_get_proxy_resolver (data->authorizer) == NULL);
+       /* Verifying the normal state of the property in a newly-constructed instance of 
GDataOAuth1Authorizer.
+        * Since the resolver comes from the SoupSession, we don’t know whether it’s initially NULL. */
+       old_proxy_resolver = gdata_oauth1_authorizer_get_proxy_resolver (data->authorizer);
 
        g_object_get (data->authorizer, "proxy-resolver", &proxy_resolver, NULL);
-       g_assert (proxy_resolver == NULL);
+       g_assert (proxy_resolver == old_proxy_resolver);
 
        g_assert_cmpuint (data->proxy_resolver_notification_count, ==, 0);
 


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