From ab879c1534ebf031eb3f632bb51782315c7d93f0 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Mon, 29 Feb 2016 03:26:06 +0000 Subject: [PATCH] Added unit tests to check that the connection fails using invalid settings. --- source/tests/xestiacalendar_caldav.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/source/tests/xestiacalendar_caldav.h b/source/tests/xestiacalendar_caldav.h index c4db5ba..e8932b8 100644 --- a/source/tests/xestiacalendar_caldav.h +++ b/source/tests/xestiacalendar_caldav.h @@ -157,6 +157,30 @@ TEST(CalDAV, BasicTests){ // Do another connection and this time the connection should // fail due to being an invalid host name. + CalDAVConnectionData ConnPlainFail; + ConnPlainFail.Hostname = "server.invalid"; + ConnPlainFail.Username = "fail"; + ConnPlainFail.Password = "fail"; + ConnPlainFail.Port = 80; + ConnPlainFail.UseSSL = false; + + // Setup the CalDAV connection object. + + CalDAV CalDAVPlainFail; + CalDAVPlainFail.SetupConnectionData(&ConnPlainFail); + + // Setup the CalDAVStatus object. + + CalDAVStatus CalDAVPlainFailStatus = CalDAVPlain.GetConnectionData(); + + // Connect and fail. + + ConnResult = CalDAVPlainFail.Connect(); + + ASSERT_EQ(CALDAVQUERYRESULT_SERVERERROR, ConnResult.Result); + ASSERT_EQ(0, ConnResult.HTTPCode); + ASSERT_EQ(CURLE_COULDNT_RESOLVE_HOST, ConnResult.Code); + // (*nix version) Setup an initial connection (with a valid // SSL certificate). -- 2.39.5