[libgweather/benzea/gnome-3-36-met.no-backport: 3/9] tests: Make it easier to see soup status on failure




commit f6db5b7021876d1403fb97b7d04a30e5aa9a7570
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Jan 7 14:53:36 2021 +0100

    tests: Make it easier to see soup status on failure
    
    Can be useful if libsoup and dependencies aren't installed properly and,
    say, SSL/TLS support is broken.
    
    GWeather:ERROR:test_libgweather.c:427:test_metar_weather_stations: assertion failed (msg->status_code >= 
200): (6 >= 200)

 libgweather/test_libgweather.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/libgweather/test_libgweather.c b/libgweather/test_libgweather.c
index e0e4b815..22280ca1 100644
--- a/libgweather/test_libgweather.c
+++ b/libgweather/test_libgweather.c
@@ -420,7 +420,13 @@ test_metar_weather_stations (void)
     msg = soup_message_new ("GET", METAR_SOURCES);
     session = soup_session_new ();
     soup_session_send_message (session, msg);
-    g_assert (SOUP_STATUS_IS_SUCCESSFUL (msg->status_code));
+    if (msg->status_code == SOUP_STATUS_SSL_FAILED) {
+        g_test_message ("SSL/TLS failure, please check your glib-networking installation");
+        g_test_failed ();
+        return;
+    }
+    g_assert_cmpint (msg->status_code, >=, 200);
+    g_assert_cmpint (msg->status_code, <, 300);
     g_object_unref (session);
     g_assert_nonnull (msg->response_body);
 


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