From 15992dd4b8f9f8d03a0e9e625163ed1cf40a8884 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sun, 6 Mar 2016 10:45:40 +0000 Subject: [PATCH] Added unit tests for the CalDAV::GetCalendarHome function. --- source/tests/xestiacalendar_caldav.h | 71 ++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/source/tests/xestiacalendar_caldav.h b/source/tests/xestiacalendar_caldav.h index 7d4c005..fc5a501 100644 --- a/source/tests/xestiacalendar_caldav.h +++ b/source/tests/xestiacalendar_caldav.h @@ -368,6 +368,77 @@ TEST(CalDAV, CalendarServerSupport){ } +TEST(CalDAV, GetCalendarHome){ + + CalDAVConnectionData ConnNormal; + + bool ValidDataNormal = false; + + // Attempt to read the caldavtest.auth file. + + ProcessConnectionDataFileResult DataFileResult = ProcessConnectionDataFile("caldavtest.auth", &ConnNormal); + if (DataFileResult == PROCESSCONNECTIONDATAFILE_OK){ + ValidDataNormal = true; + } + + ASSERT_EQ(true, ValidDataNormal); + + // Setup the connection. + + CalDAV ServerConnection; + + ServerConnection.SetupConnectionData(&ConnNormal); + + // Verify the connection settings. + + CalDAVStatus CalDAVStatus = ServerConnection.GetConnectionData(); + + ASSERT_EQ(CalDAVStatus.Hostname, ConnNormal.Hostname); + ASSERT_EQ(CalDAVStatus.Username, ConnNormal.Username); + ASSERT_EQ(CalDAVStatus.Port, ConnNormal.Port); + ASSERT_EQ(CalDAVStatus.Prefix, ConnNormal.Prefix); + ASSERT_EQ(CalDAVStatus.UseSSL, ConnNormal.UseSSL); + + // Connect to the server. + + CalDAVServerResult ConnResult = ServerConnection.Connect(); + + ASSERT_EQ(CALDAVQUERYRESULT_OK, ConnResult.Result); + ASSERT_EQ(200, ConnResult.HTTPCode); + ASSERT_EQ(CURLE_OK, ConnResult.Code); + + // Check for basic support of the calendar server. + + CalDAVServerSupport ConnSupport = ServerConnection.GetServerSupport(); + + ASSERT_EQ(true, ConnSupport.BasicSupport); + + // Get the user principal. + + string CurrentUserPrincipal = ServerConnection.GetUserPrincipal(); + + // Check the response from the server. + + ConnResult = ServerConnection.GetServerResult(); + + EXPECT_EQ(CALDAVQUERYRESULT_OK, ConnResult.Result); + ASSERT_EQ(207, ConnResult.HTTPCode); + ASSERT_EQ(CURLE_OK, ConnResult.Code); + + // Get the calendar home. + + string CalendarHome = ServerConnection.GetCalendarHome(CurrentUserPrincipal); + + // Check the response from the server. + + ConnResult = ServerConnection.GetServerResult(); + + EXPECT_EQ(CALDAVQUERYRESULT_OK, ConnResult.Result); + ASSERT_EQ(207, ConnResult.HTTPCode); + ASSERT_EQ(CURLE_OK, ConnResult.Code); + +} + TEST(CalDAV, ListCalendars){ CalDAVConnectionData ConnNormal; -- 2.39.5