summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2021-01-07 14:53:36 +0100
committerBastien Nocera <hadess@hadess.net>2021-01-12 10:05:43 +0100
commit25db1ca63de7b42f4a9dc8ce15a52f8b475c48cf (patch)
tree571479212e9d4ed2aa59049cb4ce8160316ddd73
parent5bfc598893d2d7a650b20127ff0165da51b9f3b9 (diff)
downloadlibgweather-25db1ca63de7b42f4a9dc8ce15a52f8b475c48cf.tar.gz
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)
-rw-r--r--libgweather/test_libgweather.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libgweather/test_libgweather.c b/libgweather/test_libgweather.c
index af6d5fc..500faf3 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);