From abfbaa5a9337a9d9ddc700bd8c5fa3c0aded0ab9 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Tue, 1 Mar 2016 17:06:06 +0000 Subject: [PATCH] Aded unit tests for checking when a server timeouts. --- source/tests/xestiacalendar_caldav.h | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/source/tests/xestiacalendar_caldav.h b/source/tests/xestiacalendar_caldav.h index 45da6f7..e2660fb 100644 --- a/source/tests/xestiacalendar_caldav.h +++ b/source/tests/xestiacalendar_caldav.h @@ -59,7 +59,7 @@ TEST(CalDAV, BasicTests){ // Attempt to read the caldavtest-timeout.auth file. - DataFileResult = ProcessConnectionDataFile("caldavtest-fail.auth", &ConnTimeout); + DataFileResult = ProcessConnectionDataFile("caldavtest-timeout.auth", &ConnTimeout); if (DataFileResult == PROCESSCONNECTIONDATAFILE_OK){ ValidDataTimeout = true; } @@ -236,6 +236,26 @@ TEST(CalDAV, BasicTests){ // (*nix version) Setup an inital connection on a server where // a timeout occurs. + CalDAV CalDAVTimeout; + CalDAVTimeout.SetupConnectionData(&ConnTimeout); + + // Verify that the settings match with the CalDAVConnectionData + // passed. + + CalDAVStatus CalDAVTimeoutStatus = CalDAVTimeout.GetConnectionData(); + + ASSERT_EQ(CalDAVTimeoutStatus.Hostname, ConnTimeout.Hostname); + ASSERT_EQ(CalDAVTimeoutStatus.Username, ConnTimeout.Username); + ASSERT_EQ(CalDAVTimeoutStatus.Port, ConnTimeout.Port); + ASSERT_EQ(CalDAVTimeoutStatus.Prefix, ConnTimeout.Prefix); + ASSERT_EQ(CalDAVTimeoutStatus.UseSSL, ConnTimeout.UseSSL); + // Verify that the connection had timed out. + ConnResult = CalDAVTimeout.Connect(); + + ASSERT_EQ(CALDAVQUERYRESULT_SERVERERROR, ConnResult.Result); + ASSERT_EQ(0, ConnResult.HTTPCode); + ASSERT_EQ(CURLE_OPERATION_TIMEDOUT, ConnResult.Code); + } \ No newline at end of file -- 2.39.5