[libgdata/offline-testing] tests: Add trace file testing support to the OAuth 1 test suite



commit 8f9220b3ddaccb813147c14c7839df76b96213de
Author: Philip Withnall <philip tecnocode co uk>
Date:   Mon Jul 29 18:16:48 2013 +0200

    tests: Add trace file testing support to the OAuth 1 test suite

 gdata/tests/oauth1-authorizer.c                    |  188 +++++++++++++-------
 ...th1-authorizer-interactive-data-bad-credentials |   25 +++
 ...th1-authorizer-request-authentication-uri-async |   25 +++
 ...uth1-authorizer-request-authentication-uri-sync |   25 +++
 .../oauth1-authorizer-request-authorization-async  |   25 +++
 ...zer-request-authorization-async-bad-credentials |   26 +++
 .../oauth1-authorizer-request-authorization-sync   |   25 +++
 ...izer-request-authorization-sync-bad-credentials |   26 +++
 .../setup-oauth1-authorizer-data-authenticated     |   50 +++++
 .../setup-oauth1-authorizer-interactive-data       |   25 +++
 10 files changed, 377 insertions(+), 63 deletions(-)
---
diff --git a/gdata/tests/oauth1-authorizer.c b/gdata/tests/oauth1-authorizer.c
index 0cc4efc..8a7990f 100644
--- a/gdata/tests/oauth1-authorizer.c
+++ b/gdata/tests/oauth1-authorizer.c
@@ -23,6 +23,7 @@
 #include "common.h"
 
 static GThread *main_thread = NULL;
+static GDataMockServer *mock_server = NULL;
 
 static void
 test_oauth1_authorizer_constructor (void)
@@ -170,6 +171,8 @@ set_up_oauth1_authorizer_data_authenticated (OAuth1AuthorizerData *data, gconstp
        gboolean *skip_test = (gboolean*) user_data;
        gchar *authentication_uri, *token, *token_secret, *verifier;
 
+       gdata_test_mock_server_start_trace (mock_server, "setup-oauth1-authorizer-data-authenticated");
+
        /* Chain up */
        set_up_oauth1_authorizer_data (data, NULL);
 
@@ -194,6 +197,8 @@ skip_test:
        g_free (token);
        g_free (token_secret);
        g_free (verifier);
+
+       gdata_mock_server_end_trace (mock_server);
 }
 
 static void
@@ -384,9 +389,13 @@ test_oauth1_authorizer_refresh_authorization (OAuth1AuthorizerData *data, gconst
                return;
        }
 
+       gdata_test_mock_server_start_trace (mock_server, "oauth1-authorizer-refresh-authorization");
+
        g_assert (gdata_authorizer_refresh_authorization (GDATA_AUTHORIZER (data->authorizer), NULL, &error) 
== FALSE);
        g_assert_no_error (error);
        g_clear_error (&error);
+
+       gdata_mock_server_end_trace (mock_server);
 }
 
 /* Test that processing a request with a NULL domain will not change the request. */
@@ -483,6 +492,8 @@ test_oauth1_authorizer_request_authentication_uri_sync (OAuth1AuthorizerData *da
        gchar *authentication_uri, *token, *token_secret;
        GError *error = NULL;
 
+       gdata_test_mock_server_start_trace (mock_server, "oauth1-authorizer-request-authentication-uri-sync");
+
        authentication_uri = gdata_oauth1_authorizer_request_authentication_uri (data->authorizer, &token, 
&token_secret, NULL, &error);
        g_assert_no_error (error);
        g_assert (authentication_uri != NULL && *authentication_uri != '\0');
@@ -496,6 +507,8 @@ test_oauth1_authorizer_request_authentication_uri_sync (OAuth1AuthorizerData *da
        g_free (authentication_uri);
        g_free (token);
        g_free (token_secret);
+
+       gdata_mock_server_end_trace (mock_server);
 }
 
 /* Test that requesting an authentication URI synchronously can be cancelled */
@@ -507,6 +520,8 @@ test_oauth1_authorizer_request_authentication_uri_sync_cancellation (OAuth1Autho
        GCancellable *cancellable;
        GError *error = NULL;
 
+       gdata_test_mock_server_start_trace (mock_server, 
"oauth1-authorizer-request-authentication-uri-sync-cancellation");
+
        /* Set up the cancellable */
        cancellable = g_cancellable_new ();
 
@@ -524,6 +539,8 @@ test_oauth1_authorizer_request_authentication_uri_sync_cancellation (OAuth1Autho
        g_free (token_secret);
 
        g_object_unref (cancellable);
+
+       gdata_mock_server_end_trace (mock_server);
 }
 
 typedef struct {
@@ -588,12 +605,16 @@ test_oauth1_authorizer_request_authentication_uri_async_cb (GDataOAuth1Authorize
 static void
 test_oauth1_authorizer_request_authentication_uri_async (OAuth1AuthorizerAsyncData *data, gconstpointer 
user_data)
 {
+       gdata_test_mock_server_start_trace (mock_server, 
"oauth1-authorizer-request-authentication-uri-async");
+
        /* Create a main loop and request an authentication URI */
        gdata_oauth1_authorizer_request_authentication_uri_async (data->parent.authorizer, NULL,
                                                                  (GAsyncReadyCallback) 
test_oauth1_authorizer_request_authentication_uri_async_cb,
                                                                  data);
 
        g_main_loop_run (data->main_loop);
+
+       gdata_mock_server_end_trace (mock_server);
 }
 
 static void
@@ -624,6 +645,8 @@ test_oauth1_authorizer_request_authentication_uri_async_cancellation (OAuth1Auth
 {
        GCancellable *cancellable;
 
+       gdata_test_mock_server_start_trace (mock_server, 
"oauth1-authorizer-request-authentication-uri-async-cancellation");
+
        /* Set up the cancellable */
        cancellable = g_cancellable_new ();
 
@@ -637,6 +660,8 @@ test_oauth1_authorizer_request_authentication_uri_async_cancellation (OAuth1Auth
        g_main_loop_run (data->main_loop);
 
        g_object_unref (cancellable);
+
+       gdata_mock_server_end_trace (mock_server);
 }
 
 typedef struct {
@@ -655,6 +680,8 @@ set_up_oauth1_authorizer_interactive_data (OAuth1AuthorizerInteractiveData *data
        /* Chain up */
        set_up_oauth1_authorizer_data ((OAuth1AuthorizerData*) data, user_data);
 
+       gdata_test_mock_server_start_trace (mock_server, "setup-oauth1-authorizer-interactive-data");
+
        /* Get an authentication URI */
        authentication_uri = gdata_oauth1_authorizer_request_authentication_uri (data->parent.authorizer, 
&(data->token), &(data->token_secret),
                                                                                 NULL, NULL);
@@ -664,6 +691,8 @@ set_up_oauth1_authorizer_interactive_data (OAuth1AuthorizerInteractiveData *data
        data->verifier = query_user_for_verifier (authentication_uri);
 
        g_free (authentication_uri);
+
+       gdata_mock_server_end_trace (mock_server);
 }
 
 static void
@@ -674,6 +703,8 @@ set_up_oauth1_authorizer_interactive_data_bad_credentials (OAuth1AuthorizerInter
        /* Chain up */
        set_up_oauth1_authorizer_data ((OAuth1AuthorizerData*) data, user_data);
 
+       gdata_test_mock_server_start_trace (mock_server, 
"oauth1-authorizer-interactive-data-bad-credentials");
+
        /* Get an authentication URI */
        authentication_uri = gdata_oauth1_authorizer_request_authentication_uri (data->parent.authorizer, 
&(data->token), &(data->token_secret),
                                                                                 NULL, NULL);
@@ -683,6 +714,8 @@ set_up_oauth1_authorizer_interactive_data_bad_credentials (OAuth1AuthorizerInter
        data->verifier = g_strdup ("test");
 
        g_free (authentication_uri);
+
+       gdata_mock_server_end_trace (mock_server);
 }
 
 static void
@@ -709,6 +742,8 @@ test_oauth1_authorizer_request_authorization_sync (OAuth1AuthorizerInteractiveDa
                return;
        }
 
+       gdata_test_mock_server_start_trace (mock_server, "oauth1-authorizer-request-authorization-sync");
+
        /* Check we're not authorised beforehand */
        g_assert (gdata_authorizer_is_authorized_for_domain (GDATA_AUTHORIZER (data->parent.authorizer),
                  gdata_contacts_service_get_primary_authorization_domain ()) == FALSE);
@@ -723,6 +758,8 @@ test_oauth1_authorizer_request_authorization_sync (OAuth1AuthorizerInteractiveDa
        /* Are we authorised now? */
        g_assert (gdata_authorizer_is_authorized_for_domain (GDATA_AUTHORIZER (data->parent.authorizer),
                  gdata_contacts_service_get_primary_authorization_domain ()) == TRUE);
+
+       gdata_mock_server_end_trace (mock_server);
 }
 
 /* Test that synchronously authorizing a request token fails if an invalid verifier is provided. */
@@ -732,6 +769,8 @@ test_oauth1_authorizer_request_authorization_sync_bad_credentials (OAuth1Authori
        gboolean success;
        GError *error = NULL;
 
+       gdata_test_mock_server_start_trace (mock_server, 
"oauth1-authorizer-request-authorization-sync-bad-credentials");
+
        /* Check we're not authorised beforehand */
        g_assert (gdata_authorizer_is_authorized_for_domain (GDATA_AUTHORIZER (data->parent.authorizer),
                  gdata_contacts_service_get_primary_authorization_domain ()) == FALSE);
@@ -746,6 +785,8 @@ test_oauth1_authorizer_request_authorization_sync_bad_credentials (OAuth1Authori
        /* Are we authorised now? */
        g_assert (gdata_authorizer_is_authorized_for_domain (GDATA_AUTHORIZER (data->parent.authorizer),
                  gdata_contacts_service_get_primary_authorization_domain ()) == FALSE);
+
+       gdata_mock_server_end_trace (mock_server);
 }
 
 /* Test that cancellation of synchronously authorizing a request token works. Note that this test has to be 
interactive, as the user has to visit the
@@ -762,6 +803,8 @@ test_oauth1_authorizer_request_authorization_sync_cancellation (OAuth1Authorizer
                return;
        }
 
+       gdata_test_mock_server_start_trace (mock_server, 
"oauth1-authorizer-request-authorization-sync-cancellation");
+
        /* Check we're not authorised beforehand */
        g_assert (gdata_authorizer_is_authorized_for_domain (GDATA_AUTHORIZER (data->parent.authorizer),
                  gdata_contacts_service_get_primary_authorization_domain ()) == FALSE);
@@ -782,6 +825,8 @@ test_oauth1_authorizer_request_authorization_sync_cancellation (OAuth1Authorizer
                  gdata_contacts_service_get_primary_authorization_domain ()) == FALSE);
 
        g_object_unref (cancellable);
+
+       gdata_mock_server_end_trace (mock_server);
 }
 
 typedef struct {
@@ -848,6 +893,8 @@ test_oauth1_authorizer_request_authorization_async (OAuth1AuthorizerInteractiveA
                return;
        }
 
+       gdata_test_mock_server_start_trace (mock_server, "oauth1-authorizer-request-authorization-async");
+
        /* Check we're not authorised beforehand */
        g_assert (gdata_authorizer_is_authorized_for_domain (GDATA_AUTHORIZER 
(data->parent.parent.authorizer),
                  gdata_contacts_service_get_primary_authorization_domain ()) == FALSE);
@@ -858,6 +905,8 @@ test_oauth1_authorizer_request_authorization_async (OAuth1AuthorizerInteractiveA
                                                             (GAsyncReadyCallback) 
test_oauth1_authorizer_request_authorization_async_cb, data);
 
        g_main_loop_run (data->main_loop);
+
+       gdata_mock_server_end_trace (mock_server);
 }
 
 static void
@@ -883,6 +932,8 @@ test_oauth1_authorizer_request_authorization_async_bad_credentials_cb (GDataOAut
 static void
 test_oauth1_authorizer_request_authorization_async_bad_credentials (OAuth1AuthorizerInteractiveAsyncData 
*data, gconstpointer user_data)
 {
+       gdata_test_mock_server_start_trace (mock_server, 
"oauth1-authorizer-request-authorization-async-bad-credentials");
+
        /* Check we're not authorised beforehand */
        g_assert (gdata_authorizer_is_authorized_for_domain (GDATA_AUTHORIZER 
(data->parent.parent.authorizer),
                  gdata_contacts_service_get_primary_authorization_domain ()) == FALSE);
@@ -895,6 +946,8 @@ test_oauth1_authorizer_request_authorization_async_bad_credentials (OAuth1Author
                                                             data);
 
        g_main_loop_run (data->main_loop);
+
+       gdata_mock_server_end_trace (mock_server);
 }
 
 static void
@@ -928,6 +981,8 @@ test_oauth1_authorizer_request_authorization_async_cancellation (OAuth1Authorize
                return;
        }
 
+       gdata_test_mock_server_start_trace (mock_server, 
"oauth1-authorizer-request-authorization-async-cancellation");
+
        /* Check we're not authorised beforehand */
        g_assert (gdata_authorizer_is_authorized_for_domain (GDATA_AUTHORIZER 
(data->parent.parent.authorizer),
                  gdata_contacts_service_get_primary_authorization_domain ()) == FALSE);
@@ -945,13 +1000,22 @@ test_oauth1_authorizer_request_authorization_async_cancellation (OAuth1Authorize
        g_main_loop_run (data->main_loop);
 
        g_object_unref (cancellable);
+
+       gdata_mock_server_end_trace (mock_server);
 }
 
 int
 main (int argc, char *argv[])
 {
+       GFile *trace_directory;
+
        gdata_test_init (argc, argv);
 
+       mock_server = gdata_test_get_mock_server ();
+       trace_directory = g_file_new_for_path ("traces/oauth1-authorizer");
+       gdata_mock_server_set_trace_directory (mock_server, trace_directory);
+       g_object_unref (trace_directory);
+
        main_thread = g_thread_self ();
 
        g_test_add_func ("/oauth1-authorizer/constructor", test_oauth1_authorizer_constructor);
@@ -977,71 +1041,69 @@ main (int argc, char *argv[])
        g_test_add ("/oauth1-authorizer/process-request/unauthenticated", OAuth1AuthorizerData, NULL,
                    set_up_oauth1_authorizer_data, test_oauth1_authorizer_process_request_unauthenticated, 
tear_down_oauth1_authorizer_data);
 
-       if (gdata_test_internet () == TRUE) {
-               /* Sync request-authentication-uri tests */
-               g_test_add ("/oauth1-authorizer/request-authentication-uri/sync", OAuth1AuthorizerData, NULL, 
set_up_oauth1_authorizer_data,
-                           test_oauth1_authorizer_request_authentication_uri_sync, 
tear_down_oauth1_authorizer_data);
-               g_test_add ("/oauth1-authorizer/request-authentication-uri/sync/multiple-domains", 
OAuth1AuthorizerData, NULL,
-                           set_up_oauth1_authorizer_data_multiple_domains, 
test_oauth1_authorizer_request_authentication_uri_sync,
-                           tear_down_oauth1_authorizer_data);
-               g_test_add ("/oauth1-authorizer/request-authentication-uri/sync/multiple-domains", 
OAuth1AuthorizerData, NULL,
-                           set_up_oauth1_authorizer_data_locale, 
test_oauth1_authorizer_request_authentication_uri_sync,
-                           tear_down_oauth1_authorizer_data);
-               g_test_add ("/oauth1-authorizer/request-authentication-uri/sync/cancellation", 
OAuth1AuthorizerData, NULL,
-                           set_up_oauth1_authorizer_data, 
test_oauth1_authorizer_request_authentication_uri_sync_cancellation,
+       /* Sync request-authentication-uri tests */
+       g_test_add ("/oauth1-authorizer/request-authentication-uri/sync", OAuth1AuthorizerData, NULL, 
set_up_oauth1_authorizer_data,
+                   test_oauth1_authorizer_request_authentication_uri_sync, tear_down_oauth1_authorizer_data);
+       g_test_add ("/oauth1-authorizer/request-authentication-uri/sync/multiple-domains", 
OAuth1AuthorizerData, NULL,
+                   set_up_oauth1_authorizer_data_multiple_domains, 
test_oauth1_authorizer_request_authentication_uri_sync,
+                   tear_down_oauth1_authorizer_data);
+       g_test_add ("/oauth1-authorizer/request-authentication-uri/sync/multiple-domains", 
OAuth1AuthorizerData, NULL,
+                   set_up_oauth1_authorizer_data_locale, 
test_oauth1_authorizer_request_authentication_uri_sync,
+                   tear_down_oauth1_authorizer_data);
+       g_test_add ("/oauth1-authorizer/request-authentication-uri/sync/cancellation", OAuth1AuthorizerData, 
NULL,
+                   set_up_oauth1_authorizer_data, 
test_oauth1_authorizer_request_authentication_uri_sync_cancellation,
+                   tear_down_oauth1_authorizer_data);
+
+       /* Async request-authentication-uri tests */
+       g_test_add ("/oauth1-authorizer/request-authentication-uri/async", OAuth1AuthorizerAsyncData, NULL,
+                   set_up_oauth1_authorizer_async_data, 
test_oauth1_authorizer_request_authentication_uri_async,
+                   tear_down_oauth1_authorizer_async_data);
+       g_test_add ("/oauth1-authorizer/request-authentication-uri/async/multiple-domains", 
OAuth1AuthorizerAsyncData, NULL,
+                   set_up_oauth1_authorizer_async_data_multiple_domains, 
test_oauth1_authorizer_request_authentication_uri_async,
+                   tear_down_oauth1_authorizer_async_data);
+       g_test_add ("/oauth1-authorizer/request-authentication-uri/async/cancellation", 
OAuth1AuthorizerAsyncData, NULL,
+                   set_up_oauth1_authorizer_async_data, 
test_oauth1_authorizer_request_authentication_uri_async_cancellation,
+                   tear_down_oauth1_authorizer_async_data);
+
+       /* Sync request-authorization tests */
+       if (gdata_test_interactive () == TRUE) {
+               g_test_add ("/oauth1-authorizer/request-authorization/sync", OAuth1AuthorizerInteractiveData, 
NULL,
+                           set_up_oauth1_authorizer_interactive_data, 
test_oauth1_authorizer_request_authorization_sync,
+                           tear_down_oauth1_authorizer_interactive_data);
+               g_test_add ("/oauth1-authorizer/request-authorization/sync/cancellation", 
OAuth1AuthorizerInteractiveData, NULL,
+                           set_up_oauth1_authorizer_interactive_data, 
test_oauth1_authorizer_request_authorization_sync_cancellation,
+                           tear_down_oauth1_authorizer_interactive_data);
+       }
+
+       g_test_add ("/oauth1-authorizer/request-authorization/sync/bad-credentials", 
OAuth1AuthorizerInteractiveData, NULL,
+                   set_up_oauth1_authorizer_interactive_data_bad_credentials,
+                   test_oauth1_authorizer_request_authorization_sync_bad_credentials, 
tear_down_oauth1_authorizer_interactive_data);
+
+       /* Async request-authorization tests */
+       if (gdata_test_interactive () == TRUE) {
+               g_test_add ("/oauth1-authorizer/request-authorization/async", 
OAuth1AuthorizerInteractiveAsyncData, NULL,
+                           set_up_oauth1_authorizer_interactive_async_data, 
test_oauth1_authorizer_request_authorization_async,
+                           tear_down_oauth1_authorizer_interactive_async_data);
+               g_test_add ("/oauth1-authorizer/request-authorization/async/cancellation", 
OAuth1AuthorizerInteractiveAsyncData, NULL,
+                           set_up_oauth1_authorizer_interactive_async_data, 
test_oauth1_authorizer_request_authorization_async_cancellation,
+                           tear_down_oauth1_authorizer_interactive_async_data);
+       }
+
+       g_test_add ("/oauth1-authorizer/request-authorization/async/bad-credentials", 
OAuth1AuthorizerInteractiveAsyncData, NULL,
+                   set_up_oauth1_authorizer_interactive_async_data_bad_credentials,
+                   test_oauth1_authorizer_request_authorization_async_bad_credentials, 
tear_down_oauth1_authorizer_interactive_async_data);
+
+       /* Miscellaneous tests */
+       if (gdata_test_interactive () == TRUE) {
+               gboolean skip_test = FALSE;
+
+               g_test_add ("/oauth1-authorizer/refresh-authorization/authenticated", OAuth1AuthorizerData, 
&skip_test,
+                           set_up_oauth1_authorizer_data_authenticated, 
test_oauth1_authorizer_refresh_authorization,
                            tear_down_oauth1_authorizer_data);
 
-               /* Async request-authentication-uri tests */
-               g_test_add ("/oauth1-authorizer/request-authentication-uri/async", OAuth1AuthorizerAsyncData, 
NULL,
-                           set_up_oauth1_authorizer_async_data, 
test_oauth1_authorizer_request_authentication_uri_async,
-                           tear_down_oauth1_authorizer_async_data);
-               g_test_add ("/oauth1-authorizer/request-authentication-uri/async/multiple-domains", 
OAuth1AuthorizerAsyncData, NULL,
-                           set_up_oauth1_authorizer_async_data_multiple_domains, 
test_oauth1_authorizer_request_authentication_uri_async,
-                           tear_down_oauth1_authorizer_async_data);
-               g_test_add ("/oauth1-authorizer/request-authentication-uri/async/cancellation", 
OAuth1AuthorizerAsyncData, NULL,
-                           set_up_oauth1_authorizer_async_data, 
test_oauth1_authorizer_request_authentication_uri_async_cancellation,
-                           tear_down_oauth1_authorizer_async_data);
-
-               /* Sync request-authorization tests */
-               if (gdata_test_interactive () == TRUE) {
-                       g_test_add ("/oauth1-authorizer/request-authorization/sync", 
OAuth1AuthorizerInteractiveData, NULL,
-                                   set_up_oauth1_authorizer_interactive_data, 
test_oauth1_authorizer_request_authorization_sync,
-                                   tear_down_oauth1_authorizer_interactive_data);
-                       g_test_add ("/oauth1-authorizer/request-authorization/sync/cancellation", 
OAuth1AuthorizerInteractiveData, NULL,
-                                   set_up_oauth1_authorizer_interactive_data, 
test_oauth1_authorizer_request_authorization_sync_cancellation,
-                                   tear_down_oauth1_authorizer_interactive_data);
-               }
-
-               g_test_add ("/oauth1-authorizer/request-authorization/sync/bad-credentials", 
OAuth1AuthorizerInteractiveData, NULL,
-                           set_up_oauth1_authorizer_interactive_data_bad_credentials,
-                           test_oauth1_authorizer_request_authorization_sync_bad_credentials, 
tear_down_oauth1_authorizer_interactive_data);
-
-               /* Async request-authorization tests */
-               if (gdata_test_interactive () == TRUE) {
-                       g_test_add ("/oauth1-authorizer/request-authorization/async", 
OAuth1AuthorizerInteractiveAsyncData, NULL,
-                                   set_up_oauth1_authorizer_interactive_async_data, 
test_oauth1_authorizer_request_authorization_async,
-                                   tear_down_oauth1_authorizer_interactive_async_data);
-                       g_test_add ("/oauth1-authorizer/request-authorization/async/cancellation", 
OAuth1AuthorizerInteractiveAsyncData, NULL,
-                                   set_up_oauth1_authorizer_interactive_async_data, 
test_oauth1_authorizer_request_authorization_async_cancellation,
-                                   tear_down_oauth1_authorizer_interactive_async_data);
-               }
-
-               g_test_add ("/oauth1-authorizer/request-authorization/async/bad-credentials", 
OAuth1AuthorizerInteractiveAsyncData, NULL,
-                           set_up_oauth1_authorizer_interactive_async_data_bad_credentials,
-                           test_oauth1_authorizer_request_authorization_async_bad_credentials, 
tear_down_oauth1_authorizer_interactive_async_data);
-
-               /* Miscellaneous tests */
-               if (gdata_test_interactive () == TRUE) {
-                       gboolean skip_test = FALSE;
-
-                       g_test_add ("/oauth1-authorizer/refresh-authorization/authenticated", 
OAuth1AuthorizerData, &skip_test,
-                                   set_up_oauth1_authorizer_data_authenticated, 
test_oauth1_authorizer_refresh_authorization,
-                                   tear_down_oauth1_authorizer_data);
-
-                       g_test_add ("/oauth1-authorizer/process-request/authenticated", OAuth1AuthorizerData, 
&skip_test,
-                                   set_up_oauth1_authorizer_data_authenticated, 
test_oauth1_authorizer_process_request_authenticated,
-                                   tear_down_oauth1_authorizer_data);
-               }
+               g_test_add ("/oauth1-authorizer/process-request/authenticated", OAuth1AuthorizerData, 
&skip_test,
+                           set_up_oauth1_authorizer_data_authenticated, 
test_oauth1_authorizer_process_request_authenticated,
+                           tear_down_oauth1_authorizer_data);
        }
 
        return g_test_run ();
diff --git a/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-interactive-data-bad-credentials 
b/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-interactive-data-bad-credentials
new file mode 100644
index 0000000..5187564
--- /dev/null
+++ b/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-interactive-data-bad-credentials
@@ -0,0 +1,25 @@
+> POST /accounts/OAuthGetRequestToken HTTP/1.1
+> Soup-Debug-Timestamp: 1375114467
+> Soup-Debug: SoupSession 1 (0x6502c0), SoupMessage 1 (0x9750e0), SoupSocket 1 (0x9933b0)
+> Host: www.google.com
+> Content-Type: application/x-www-form-urlencoded
+> Authorization: OAuth 
oauth_consumer_key="anonymous",oauth_signature_method="HMAC-SHA1",oauth_signature="N7FRU%2BJKa4kkjlUpzlGAHSxPUqg%3D",oauth_timestamp="1375114466",oauth_nonce="JKLrpVu2KW9WiZwsbko1MHtRh",oauth_version="1.0"
+> Accept-Encoding: gzip, deflate
+> Connection: Keep-Alive
+> 
+> 
xoauth%5Fdisplayname=Application+name&scope=https%3A%2F%2Fwww%2Egoogle%2Ecom%2Fm8%2Ffeeds%2F&oauth%5Fcallback=oob
+  
+< HTTP/1.1 200 OK
+< Soup-Debug-Timestamp: 1375114467
+< Soup-Debug: SoupMessage 1 (0x9750e0)
+< Content-Type: text/plain; charset=UTF-8
+< Date: Mon, 29 Jul 2013 16:14:27 GMT
+< Expires: Mon, 29 Jul 2013 16:14:27 GMT
+< Cache-Control: private, max-age=0
+< X-Content-Type-Options: nosniff
+< X-XSS-Protection: 1; mode=block
+< Content-Length: 118
+< Server: GSE
+< 
+< 
oauth_token=4%2FcPV6prKvQtxeeXkhgI1iJ6nLQbCX&oauth_token_secret=BdUGkbnkl6_UTaa0I2049cxp&oauth_callback_confirmed=true
+  
diff --git a/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-refresh-authorization 
b/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-refresh-authorization
new file mode 100644
index 0000000..e69de29
diff --git a/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authentication-uri-async 
b/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authentication-uri-async
new file mode 100644
index 0000000..282d8df
--- /dev/null
+++ b/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authentication-uri-async
@@ -0,0 +1,25 @@
+> POST /accounts/OAuthGetRequestToken HTTP/1.1
+> Soup-Debug-Timestamp: 1375114409
+> Soup-Debug: SoupSession 1 (0x650700), SoupMessage 1 (0x7fffe0012c60), SoupSocket 1 (0x7fffe0026d30)
+> Host: www.google.com
+> Content-Type: application/x-www-form-urlencoded
+> Authorization: OAuth 
oauth_consumer_key="anonymous",oauth_signature_method="HMAC-SHA1",oauth_signature="EKMKB4gUkr5rUEeps37CrSS7iWI%3D",oauth_timestamp="1375114409",oauth_nonce="IFERKYPbzEzuA3QE_Zgw1moU1ZR",oauth_version="1.0"
+> Accept-Encoding: gzip, deflate
+> Connection: Keep-Alive
+> 
+> 
xoauth%5Fdisplayname=Application+name&scope=https%3A%2F%2Fwww%2Egoogle%2Ecom%2Fm8%2Ffeeds%2F+http%3A%2F%2Fpicasaweb%2Egoogle%2Ecom%2Fdata%2F&oauth%5Fcallback=oob
+  
+< HTTP/1.1 200 OK
+< Soup-Debug-Timestamp: 1375114409
+< Soup-Debug: SoupMessage 1 (0x7fffe0012c60)
+< Content-Type: text/plain; charset=UTF-8
+< Date: Mon, 29 Jul 2013 16:13:29 GMT
+< Expires: Mon, 29 Jul 2013 16:13:29 GMT
+< Cache-Control: private, max-age=0
+< X-Content-Type-Options: nosniff
+< X-XSS-Protection: 1; mode=block
+< Content-Length: 118
+< Server: GSE
+< 
+< 
oauth_token=4%2FRzdH5fU5KLdaoDTqznYQlkMez4Wj&oauth_token_secret=GYkwQ3BIHviff69Y9Zld6g2u&oauth_callback_confirmed=true
+  
diff --git 
a/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authentication-uri-async-cancellation 
b/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authentication-uri-async-cancellation
new file mode 100644
index 0000000..e69de29
diff --git a/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authentication-uri-sync 
b/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authentication-uri-sync
new file mode 100644
index 0000000..6a45446
--- /dev/null
+++ b/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authentication-uri-sync
@@ -0,0 +1,25 @@
+> POST /accounts/OAuthGetRequestToken HTTP/1.1
+> Soup-Debug-Timestamp: 1375114409
+> Soup-Debug: SoupSession 1 (0x6505f0), SoupMessage 1 (0x975590), SoupSocket 1 (0x993530)
+> Host: www.google.com
+> Content-Type: application/x-www-form-urlencoded
+> Authorization: OAuth 
oauth_consumer_key="anonymous",oauth_signature_method="HMAC-SHA1",oauth_signature="tfOHmtfJ3fBhyQK9pvma4kx6OlM%3D",oauth_timestamp="1375114409",oauth_nonce="X4sZD_njIKcgSr6paHPVByY8LOjFA",oauth_version="1.0"
+> Accept-Encoding: gzip, deflate
+> Connection: Keep-Alive
+> 
+> 
xoauth%5Fdisplayname=Application+name&scope=https%3A%2F%2Fwww%2Egoogle%2Ecom%2Fm8%2Ffeeds%2F&oauth%5Fcallback=oob
+  
+< HTTP/1.1 200 OK
+< Soup-Debug-Timestamp: 1375114409
+< Soup-Debug: SoupMessage 1 (0x975590)
+< Content-Type: text/plain; charset=UTF-8
+< Date: Mon, 29 Jul 2013 16:13:29 GMT
+< Expires: Mon, 29 Jul 2013 16:13:29 GMT
+< Cache-Control: private, max-age=0
+< X-Content-Type-Options: nosniff
+< X-XSS-Protection: 1; mode=block
+< Content-Length: 118
+< Server: GSE
+< 
+< 
oauth_token=4%2F12bPxj_QaPxom9ALAmIMn5-ZU3wR&oauth_token_secret=Kiuy8Zz-8SzZJ8jQU_83nk9w&oauth_callback_confirmed=true
+  
diff --git 
a/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authentication-uri-sync-cancellation 
b/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authentication-uri-sync-cancellation
new file mode 100644
index 0000000..e69de29
diff --git a/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authorization-async 
b/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authorization-async
new file mode 100644
index 0000000..d9ba4ae
--- /dev/null
+++ b/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authorization-async
@@ -0,0 +1,25 @@
+> POST /accounts/OAuthGetAccessToken HTTP/1.1
+> Soup-Debug-Timestamp: 1375114434
+> Soup-Debug: SoupSession 1 (0x6503d0), SoupMessage 2 (0x7fffe0012e40), SoupSocket 2 (0x7fffe0026df0)
+> Host: www.google.com
+> Content-Type: application/x-www-form-urlencoded
+> Authorization: OAuth 
oauth_consumer_key="anonymous",oauth_token="4%2FfV2Y0aq-WjEgiSDxvVQdNqQZvX8l",oauth_signature_method="HMAC-SHA1",oauth_signature="8Px9eqo%2BkXJdZg5ufcmTGXNGHGw%3D",oauth_timestamp="1375114434",oauth_nonce="_bRhTyvvq372wr_XjB4WPWl0qt2Uq",oauth_version="1.0"
+> Accept-Encoding: gzip, deflate
+> Connection: Keep-Alive
+> 
+> oauth%5Fverifier=ks5YXkMmIT1KT4%2DG1IdRW8zH
+  
+< HTTP/1.1 200 OK
+< Soup-Debug-Timestamp: 1375114434
+< Soup-Debug: SoupMessage 2 (0x7fffe0012e40)
+< Content-Type: text/plain; charset=UTF-8
+< Date: Mon, 29 Jul 2013 16:13:54 GMT
+< Expires: Mon, 29 Jul 2013 16:13:54 GMT
+< Cache-Control: private, max-age=0
+< X-Content-Type-Options: nosniff
+< X-XSS-Protection: 1; mode=block
+< Content-Length: 103
+< Server: GSE
+< 
+< oauth_token=1%2FvMhevC5FJZeYIy87nMSvAaIoxJRDfq9MRuuYL_ASuIc&oauth_token_secret=ALKifRvO9cC4rQL43CygXqcE
+  
diff --git 
a/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authorization-async-bad-credentials 
b/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authorization-async-bad-credentials
new file mode 100644
index 0000000..492fc92
--- /dev/null
+++ b/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authorization-async-bad-credentials
@@ -0,0 +1,26 @@
+> POST /accounts/OAuthGetAccessToken HTTP/1.1
+> Soup-Debug-Timestamp: 1375114467
+> Soup-Debug: SoupSession 1 (0x6502c0), SoupMessage 2 (0x7fffe40108c0), SoupSocket 2 (0x7fffe0026eb0)
+> Host: www.google.com
+> Content-Type: application/x-www-form-urlencoded
+> Authorization: OAuth 
oauth_consumer_key="anonymous",oauth_token="4%2FcPV6prKvQtxeeXkhgI1iJ6nLQbCX",oauth_signature_method="HMAC-SHA1",oauth_signature="rtly12Qq%2FK30HSglMmLqwZVCpMM%3D",oauth_timestamp="1375114467",oauth_nonce="qBZpBSAZauOCA8vEqy5zOQBZcAS",oauth_version="1.0"
+> Accept-Encoding: gzip, deflate
+> Connection: Keep-Alive
+> 
+> oauth%5Fverifier=test
+  
+< HTTP/1.1 400 Bad Request
+< Soup-Debug-Timestamp: 1375114475
+< Soup-Debug: SoupMessage 2 (0x7fffe40108c0)
+< Content-Type: text/plain; charset=UTF-8
+< Date: Mon, 29 Jul 2013 16:14:35 GMT
+< Expires: Mon, 29 Jul 2013 16:14:35 GMT
+< Cache-Control: private, max-age=0
+< X-Content-Type-Options: nosniff
+< X-XSS-Protection: 1; mode=block
+< Content-Length: 23
+< Server: GSE
+< 
+< The token is invalid.
+< 
+  
diff --git a/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authorization-async-cancellation 
b/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authorization-async-cancellation
new file mode 100644
index 0000000..e69de29
diff --git a/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authorization-sync 
b/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authorization-sync
new file mode 100644
index 0000000..7fdfe8c
--- /dev/null
+++ b/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authorization-sync
@@ -0,0 +1,25 @@
+> POST /accounts/OAuthGetAccessToken HTTP/1.1
+> Soup-Debug-Timestamp: 1375114421
+> Soup-Debug: SoupSession 1 (0x6504e0), SoupMessage 2 (0x9753b0), SoupSocket 2 (0x993470)
+> Host: www.google.com
+> Content-Type: application/x-www-form-urlencoded
+> Authorization: OAuth 
oauth_consumer_key="anonymous",oauth_token="4%2FT27iiKNpM8PHQ2ztKzZBywZ2uKnO",oauth_signature_method="HMAC-SHA1",oauth_signature="gZChlEpXlBLy8bYjktVEfRh4XhA%3D",oauth_timestamp="1375114421",oauth_nonce="W8iIqbvygOUYCkuQdp",oauth_version="1.0"
+> Accept-Encoding: gzip, deflate
+> Connection: Keep-Alive
+> 
+> oauth%5Fverifier=7MQzdhPyajVrbVUBnaQRgj73
+  
+< HTTP/1.1 200 OK
+< Soup-Debug-Timestamp: 1375114422
+< Soup-Debug: SoupMessage 2 (0x9753b0)
+< Content-Type: text/plain; charset=UTF-8
+< Date: Mon, 29 Jul 2013 16:13:41 GMT
+< Expires: Mon, 29 Jul 2013 16:13:41 GMT
+< Cache-Control: private, max-age=0
+< X-Content-Type-Options: nosniff
+< X-XSS-Protection: 1; mode=block
+< Content-Length: 103
+< Server: GSE
+< 
+< oauth_token=1%2FkJjrwN7c2Vzx387AQP2jL3BYQHXssRU0w3XeZq4H2Mw&oauth_token_secret=98SsHIgW-Sn8Ix0Klk3wv4oy
+  
diff --git 
a/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authorization-sync-bad-credentials 
b/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authorization-sync-bad-credentials
new file mode 100644
index 0000000..8809a96
--- /dev/null
+++ b/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authorization-sync-bad-credentials
@@ -0,0 +1,26 @@
+> POST /accounts/OAuthGetAccessToken HTTP/1.1
+> Soup-Debug-Timestamp: 1375114446
+> Soup-Debug: SoupSession 1 (0x6501b0), SoupMessage 2 (0x9751d0), SoupSocket 2 (0x993230)
+> Host: www.google.com
+> Content-Type: application/x-www-form-urlencoded
+> Authorization: OAuth 
oauth_consumer_key="anonymous",oauth_token="4%2FlydzQSwq7wb73eJbj197qsgNP5Kr",oauth_signature_method="HMAC-SHA1",oauth_signature="hQRNpZi3kAzkGA1sa84EjobE%2BsU%3D",oauth_timestamp="1375114446",oauth_nonce="mqbX8TahJGtxkoP3oX_73qzA",oauth_version="1.0"
+> Accept-Encoding: gzip, deflate
+> Connection: Keep-Alive
+> 
+> oauth%5Fverifier=test
+  
+< HTTP/1.1 400 Bad Request
+< Soup-Debug-Timestamp: 1375114453
+< Soup-Debug: SoupMessage 2 (0x9751d0)
+< Content-Type: text/plain; charset=UTF-8
+< Date: Mon, 29 Jul 2013 16:14:13 GMT
+< Expires: Mon, 29 Jul 2013 16:14:13 GMT
+< Cache-Control: private, max-age=0
+< X-Content-Type-Options: nosniff
+< X-XSS-Protection: 1; mode=block
+< Content-Length: 23
+< Server: GSE
+< 
+< The token is invalid.
+< 
+  
diff --git a/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authorization-sync-cancellation 
b/gdata/tests/traces/oauth1-authorizer/oauth1-authorizer-request-authorization-sync-cancellation
new file mode 100644
index 0000000..e69de29
diff --git a/gdata/tests/traces/oauth1-authorizer/setup-oauth1-authorizer-data-authenticated 
b/gdata/tests/traces/oauth1-authorizer/setup-oauth1-authorizer-data-authenticated
new file mode 100644
index 0000000..1710b25
--- /dev/null
+++ b/gdata/tests/traces/oauth1-authorizer/setup-oauth1-authorizer-data-authenticated
@@ -0,0 +1,50 @@
+> POST /accounts/OAuthGetRequestToken HTTP/1.1
+> Soup-Debug-Timestamp: 1375114396
+> Soup-Debug: SoupSession 1 (0x6501b0), SoupMessage 1 (0x975590), SoupSocket 1 (0x993230)
+> Host: www.google.com
+> Content-Type: application/x-www-form-urlencoded
+> Authorization: OAuth 
oauth_consumer_key="anonymous",oauth_signature_method="HMAC-SHA1",oauth_signature="VfeOs%2BWTIJRUkCErU1zxKqH38oQ%3D",oauth_timestamp="1375114396",oauth_nonce="9VmUWSVrJu_zhF2cwFRdWrZFl8WUGy",oauth_version="1.0"
+> Accept-Encoding: gzip, deflate
+> Connection: Keep-Alive
+> 
+> 
xoauth%5Fdisplayname=Application+name&scope=https%3A%2F%2Fwww%2Egoogle%2Ecom%2Fm8%2Ffeeds%2F&oauth%5Fcallback=oob
+  
+< HTTP/1.1 200 OK
+< Soup-Debug-Timestamp: 1375114396
+< Soup-Debug: SoupMessage 1 (0x975590)
+< Content-Type: text/plain; charset=UTF-8
+< Date: Mon, 29 Jul 2013 16:13:16 GMT
+< Expires: Mon, 29 Jul 2013 16:13:16 GMT
+< Cache-Control: private, max-age=0
+< X-Content-Type-Options: nosniff
+< X-XSS-Protection: 1; mode=block
+< Content-Length: 118
+< Server: GSE
+< 
+< 
oauth_token=4%2F-hFowsVMagtdWjX8hTFUGw0de9nL&oauth_token_secret=kuu2KlszmJhimCI8C7uNbV6z&oauth_callback_confirmed=true
+  
+> POST /accounts/OAuthGetAccessToken HTTP/1.1
+> Soup-Debug-Timestamp: 1375114407
+> Soup-Debug: SoupSession 1 (0x6501b0), SoupMessage 2 (0x9752c0), SoupSocket 2 (0x9932f0)
+> Host: www.google.com
+> Content-Type: application/x-www-form-urlencoded
+> Authorization: OAuth 
oauth_consumer_key="anonymous",oauth_token="4%2F-hFowsVMagtdWjX8hTFUGw0de9nL",oauth_signature_method="HMAC-SHA1",oauth_signature="lWSS%2BTKHABoDsZuVU6LFxVgBrsM%3D",oauth_timestamp="1375114407",oauth_nonce="P1LCHSMETyO0IpQnTCVc",oauth_version="1.0"
+> Accept-Encoding: gzip, deflate
+> Connection: Keep-Alive
+> 
+> oauth%5Fverifier=qT64ktZBdmUVwpRClZmO6s7j
+  
+< HTTP/1.1 200 OK
+< Soup-Debug-Timestamp: 1375114408
+< Soup-Debug: SoupMessage 2 (0x9752c0)
+< Content-Type: text/plain; charset=UTF-8
+< Date: Mon, 29 Jul 2013 16:13:28 GMT
+< Expires: Mon, 29 Jul 2013 16:13:28 GMT
+< Cache-Control: private, max-age=0
+< X-Content-Type-Options: nosniff
+< X-XSS-Protection: 1; mode=block
+< Content-Length: 103
+< Server: GSE
+< 
+< oauth_token=1%2F17nuamcqEOCaMMCg9Oc9ekcfGEzkepP5_5ANtDkuwks&oauth_token_secret=wUozdZTGrBPaGKTEB9lfK61J
+  
diff --git a/gdata/tests/traces/oauth1-authorizer/setup-oauth1-authorizer-interactive-data 
b/gdata/tests/traces/oauth1-authorizer/setup-oauth1-authorizer-interactive-data
new file mode 100644
index 0000000..7731e22
--- /dev/null
+++ b/gdata/tests/traces/oauth1-authorizer/setup-oauth1-authorizer-interactive-data
@@ -0,0 +1,25 @@
+> POST /accounts/OAuthGetRequestToken HTTP/1.1
+> Soup-Debug-Timestamp: 1375114454
+> Soup-Debug: SoupSession 1 (0x6501b0), SoupMessage 1 (0x9750e0), SoupSocket 1 (0x993230)
+> Host: www.google.com
+> Content-Type: application/x-www-form-urlencoded
+> Authorization: OAuth 
oauth_consumer_key="anonymous",oauth_signature_method="HMAC-SHA1",oauth_signature="c%2FBP0C511rwGZYAGnXlXTzh5uno%3D",oauth_timestamp="1375114453",oauth_nonce="ppVVbibizHKVmJHDNHHjdc",oauth_version="1.0"
+> Accept-Encoding: gzip, deflate
+> Connection: Keep-Alive
+> 
+> 
xoauth%5Fdisplayname=Application+name&scope=https%3A%2F%2Fwww%2Egoogle%2Ecom%2Fm8%2Ffeeds%2F&oauth%5Fcallback=oob
+  
+< HTTP/1.1 200 OK
+< Soup-Debug-Timestamp: 1375114454
+< Soup-Debug: SoupMessage 1 (0x9750e0)
+< Content-Type: text/plain; charset=UTF-8
+< Date: Mon, 29 Jul 2013 16:14:14 GMT
+< Expires: Mon, 29 Jul 2013 16:14:14 GMT
+< Cache-Control: private, max-age=0
+< X-Content-Type-Options: nosniff
+< X-XSS-Protection: 1; mode=block
+< Content-Length: 118
+< Server: GSE
+< 
+< 
oauth_token=4%2F-OewZRiOoq_qWvwTpTMIsvNEqMaU&oauth_token_secret=NF1c22V04ZV6SLLLnCG4w7Ue&oauth_callback_confirmed=true
+  


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