[libgdata/offline-testing] tests: UNFINISHED fixes to the mock server



commit c301a114c59fd375241402a06323fac0fafa3326
Author: Philip Withnall <philip tecnocode co uk>
Date:   Mon Jul 29 16:42:22 2013 +0200

    tests: UNFINISHED fixes to the mock server

 gdata/gdata-service.c     |   10 +++++++++-
 gdata/tests/common.c      |    1 +
 gdata/tests/mock-server.c |    3 +++
 3 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/gdata/gdata-service.c b/gdata/gdata-service.c
index bfd01cb..b153b69 100644
--- a/gdata/gdata-service.c
+++ b/gdata/gdata-service.c
@@ -2150,7 +2150,15 @@ _gdata_service_get_log_level (void)
 SoupSession *
 _gdata_service_build_session (void)
 {
-       SoupSession *session = soup_session_new_with_options ("ssl-strict", TRUE, NULL);
+       SoupSession *session;
+       gboolean ssl_strict = TRUE;
+
+       /* Iff LIBGDATA_LAX_SSL_CERTIFICATES=1, relax SSL certificate validation to allow using 
invalid/unsigned certificates for testing. */
+       if (g_strcmp0 (g_getenv ("LIBGDATA_LAX_SSL_CERTIFICATES"), "1") == 0) {
+               ssl_strict = FALSE;
+       }
+
+       session = soup_session_new_with_options ("ssl-strict", ssl_strict, NULL);
 
 #ifdef HAVE_GNOME
        soup_session_add_feature_by_type (session, SOUP_TYPE_GNOME_FEATURES_2_26);
diff --git a/gdata/tests/common.c b/gdata/tests/common.c
index d6f51dd..fded25f 100644
--- a/gdata/tests/common.c
+++ b/gdata/tests/common.c
@@ -131,6 +131,7 @@ gdata_test_init (int argc, char **argv)
        /* Enable full debugging */
        g_setenv ("LIBGDATA_DEBUG", "4" /* GDATA_LOG_FULL */, FALSE); /* TODO */
        g_setenv ("G_MESSAGES_DEBUG", "libgdata", FALSE);
+       g_setenv ("LIBGDATA_LAX_SSL_CERTIFICATES", "1", FALSE);
 
        mock_server = gdata_mock_server_new ();
        gdata_mock_server_set_enable_logging (mock_server, write_traces);
diff --git a/gdata/tests/mock-server.c b/gdata/tests/mock-server.c
index 240bcc6..c829e57 100644
--- a/gdata/tests/mock-server.c
+++ b/gdata/tests/mock-server.c
@@ -1244,6 +1244,9 @@ gdata_mock_server_start_trace_full (GDataMockServer *self, GFile *trace_file)
        g_return_if_fail (GDATA_IS_MOCK_SERVER (self));
        g_return_if_fail (G_IS_FILE (trace_file));
 
+       if (priv->output_stream != NULL) {
+               g_warning ("%s: Nested trace files are not supported. Call gdata_mock_server_end_trace() 
before calling %s again.", G_STRFUNC, G_STRFUNC);
+       }
        g_return_if_fail (priv->output_stream == NULL);
 
        /* Start writing out a trace file if logging is enabled. */


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