X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Ftests%2Fxestiacalendar_caldav.h;h=2e5d9cbbe347f074b323f865f802a1831584b4be;hb=1ee0816458ce63e6bd689ade74295096b037c116;hp=fc5a50138248bc5f04e6ecb7bc5569587095a016;hpb=15992dd4b8f9f8d03a0e9e625163ed1cf40a8884;p=xestiacalendar%2F.git diff --git a/source/tests/xestiacalendar_caldav.h b/source/tests/xestiacalendar_caldav.h index fc5a501..2e5d9cb 100644 --- a/source/tests/xestiacalendar_caldav.h +++ b/source/tests/xestiacalendar_caldav.h @@ -498,25 +498,57 @@ TEST(CalDAV, ListCalendars){ ConnResult = ServerConnection.GetServerResult(); EXPECT_EQ(CALDAVQUERYRESULT_OK, ConnResult.Result); - ASSERT_EQ(200, ConnResult.HTTPCode); + ASSERT_EQ(207, ConnResult.HTTPCode); ASSERT_EQ(CURLE_OK, ConnResult.Code); - // Get the user principal. +} + +TEST(CalDAV, AddCalendar){ - CurrentUserPrincipal = ServerConnection.GetUserPrincipal(); + CalDAVConnectionData ConnNormal; + string CurrentUserPrincipal; + + bool ValidDataNormal = false; - // Check the response from the server. + // Attempt to read the caldavtest.auth file. + + ProcessConnectionDataFileResult DataFileResult = ProcessConnectionDataFile("caldavtest.auth", &ConnNormal); + if (DataFileResult == PROCESSCONNECTIONDATAFILE_OK){ + ValidDataNormal = true; + } + + ASSERT_EQ(true, ValidDataNormal); - ConnResult = ServerConnection.GetServerResult(); + // Setup the connection. - EXPECT_EQ(CALDAVQUERYRESULT_OK, ConnResult.Result); - ASSERT_EQ(207, ConnResult.HTTPCode); - ASSERT_EQ(CURLE_OK, ConnResult.Code); + CalDAV ServerConnection; - // Get the list of calendars. + 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(); + EXPECT_EQ(CALDAVQUERYRESULT_OK, ConnResult.Result); + ASSERT_EQ(200, ConnResult.HTTPCode); + ASSERT_EQ(CURLE_OK, ConnResult.Code); + + // Add a calendar to the server. + + ConnResult = ServerConnection.AddCalendar("New Calendar"); + EXPECT_EQ(CALDAVQUERYRESULT_OK, ConnResult.Result); + ASSERT_EQ(201, ConnResult.HTTPCode); + ASSERT_EQ(CURLE_OK, ConnResult.Code); } \ No newline at end of file