[libgweather/wip/hadess/met-no-migration: 4/6] tests: Make it easier to see soup status on failure




commit 4ba5f021aefc254d97823fe9fa881f94f74f60cf
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 af6d5fca..500faf3a 100644
--- a/libgweather/test_libgweather.c
+++ b/libgweather/test_libgweather.c
@@ -434,7 +434,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_true (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]