+ CalDAVConnectionData connNormal;
+ string currentUserPrincipal;
+
+ 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();
+
+ EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(200, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
+
+ // Check that the server supports CalDAV.
+
+ CalDAVServerSupport connSupport = serverConnection.GetServerSupport();
+ connResult = serverConnection.GetServerResult();
+
+ EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(200, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
+ ASSERT_EQ(true, connSupport.basicSupport);
+
+ // Get the list of calendars.
+
+ CalDAVCalendarList calendarList = serverConnection.GetCalendars();
+
+ // Check the response result 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, AddCalendar){
+
+ CalDAVConnectionData connNormal;
+ string currentUserPrincipal;
+
+ 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();
+
+ 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);
+
+}
+
+TEST(CalDAV, EditCalendar){
+
+ CalDAVConnectionData connNormal;
+ string currentUserPrincipal;
+
+ 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();
+
+ EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(200, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
+
+ // Check that the server supports CalDAV.
+
+ CalDAVServerSupport connSupport = serverConnection.GetServerSupport();
+ connResult = serverConnection.GetServerResult();
+
+ EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(200, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
+ ASSERT_EQ(true, connSupport.basicSupport);
+
+ // Add a calendar to the server.
+
+ connResult = serverConnection.AddCalendar("Calendar To Edit");
+
+ EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(201, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
+
+ // Get the list of calendars.
+
+ CalDAVCalendarList calendarList = serverConnection.GetCalendars();
+
+ // Check the response result from the server.
+
+ connResult = serverConnection.GetServerResult();
+
+ EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(207, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
+
+ // Find the calendar containing the name "Calendar To Edit"
+ // created earlier.
+
+ int itemSeek = 0;
+ bool itemFound = false;
+
+ for (map<int,string>::iterator calendarNameIter = calendarList.name.begin();
+ calendarNameIter != calendarList.name.end(); calendarNameIter++){
+
+ if (calendarNameIter->second == "Calendar To Edit"){
+ itemFound = true;
+ break;
+ }
+
+ itemSeek++;
+
+ }
+
+ ASSERT_NE(false, itemFound);
+
+ // Edit the name of the calendar.
+
+ string calendarEditHREF = calendarList.href[itemSeek];
+ string newCalendarName = "Edited Calendar";
+
+ connResult = serverConnection.EditCalendar(&calendarEditHREF, &newCalendarName);
+
+ EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(207, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
+
+ // Edit the colour of the calendar.
+
+ Colour newColour;
+
+ newColour.red = 255;
+ newColour.green = 0;
+ newColour.blue = 0;
+ newColour.alpha = 0;
+
+ connResult = serverConnection.EditCalendar(&calendarEditHREF, &newColour);
+
+ EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(207, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
+
+ // Edit the description of the calendar.
+
+ string newCalendarDescription = "Update Calendar Description";
+
+ connResult = serverConnection.EditCalendarDescription(&calendarEditHREF, &newCalendarDescription);
+
+ EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(207, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
+
+ // Edit the order of the calendar.
+
+ int newCalendarOrder = 30;
+
+ connResult = serverConnection.EditCalendar(&calendarEditHREF, &newCalendarOrder);
+
+ EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(207, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
+
+ // Edit all of the available properties of the calendar.
+
+ newCalendarName = "Calendar Edited Again";
+ newCalendarDescription = "Another updated calendar description";
+ newColour.red = 0;
+ newColour.green = 255;
+ newColour.blue = 0;
+ newColour.alpha = 0;
+ newCalendarOrder = 40;
+
+ connResult = serverConnection.EditCalendar(&calendarEditHREF,
+ &newCalendarName,
+ &newColour,
+ &newCalendarDescription,
+ &newCalendarOrder);
+
+ EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(207, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
+
+}
+
+TEST(CalDAV, DeleteCalendar){
+
+ CalDAVConnectionData connNormal;
+ string currentUserPrincipal;
+
+ 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();
+
+ EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(200, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
+
+ // Check that the server supports CalDAV.
+
+ CalDAVServerSupport connSupport = serverConnection.GetServerSupport();
+ connResult = serverConnection.GetServerResult();
+
+ EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(200, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
+ ASSERT_EQ(true, connSupport.basicSupport);
+
+ // Get the list of calendars.
+
+ CalDAVCalendarList calendarList = serverConnection.GetCalendars();
+
+ // Check the response result 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 with the matching name.
+
+ int itemSeek = 0;
+ bool itemFound = false;
+
+ for (map<int,string>::iterator calendarNameIter = calendarList.name.begin();
+ calendarNameIter != calendarList.name.end(); calendarNameIter++){
+
+ if (calendarNameIter->second == "Calendar Edited Again"){
+ itemFound = true;
+ break;
+ }
+
+ itemSeek++;
+
+ }
+
+ ASSERT_NE(false, itemFound);
+
+ // Delete some calendars.
+
+ string calendarEditHREF = calendarList.href[itemSeek];
+
+ connResult = serverConnection.DeleteCalendar(&calendarEditHREF);
+
+ EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(204, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
+
+}
+
+TEST(CalDAV, AddEntry){
+
+ CalDAVConnectionData connNormal;
+ string currentUserPrincipal;
+
+ 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();
+
+ EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(200, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
+
+ // Check that the server supports CalDAV.
+
+ CalDAVServerSupport connSupport = serverConnection.GetServerSupport();
+ connResult = serverConnection.GetServerResult();
+
+ EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(200, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
+ ASSERT_EQ(true, connSupport.basicSupport);
+
+ // Get the list of calendars.
+
+ CalDAVCalendarList calendarList = serverConnection.GetCalendars();
+
+ // Check the response result 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 with the matching name.
+
+ int itemSeek = 0;
+ bool itemFound = false;
+
+ for (map<int,string>::iterator calendarNameIter = calendarList.name.begin();
+ calendarNameIter != calendarList.name.end(); calendarNameIter++){
+
+ if (calendarNameIter->second == "Scratching Calendar"){
+ itemFound = true;
+ break;
+ }
+
+ itemSeek++;
+
+ }
+
+ ASSERT_NE(false, itemFound);
+
+ string entryAddHREF = calendarList.href[itemSeek];
+
+ entryUUID = GenerateUUID();
+ entryUUID.erase(entryUUID.end()-1);
+
+ entryAddHREF.append(entryUUID);
+ entryAddHREF.append(".ics");
+
+ string addEntryData = "BEGIN:VCALENDAR\n"
+ "VERSION:2.0\n"
+ "PRODID:-//Xestia//Calendar Unit Testing//KW\n"
+ "BEGIN:VEVENT\n"
+ "UID:";
+ addEntryData += entryUUID;
+ addEntryData += "\n"
+ "DTSTAMP:20160116T190200Z\n"
+ "DTSTART:20160116T190200Z\n"
+ "DTEND:20160116T190200Z\n"
+ "SUMMARY:Unit Test Event 1 which has to be a really long summary as we don't k\n"
+ " now if multiple line processing is going to work without it. I mean seriousl\n"
+ " y, how annoying can this potentially be?\n"
+ "END:VEVENT\n"
+ "END:VCALENDAR\n";
+
+ connResult = serverConnection.AddEntry(&entryAddHREF, &addEntryData);
+
+ EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(201, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
+
+ // Set the EntryCalendarHREFProcessing for later on.
+
+ entryCalendarHREFProcessing = entryAddHREF;
+
+}
+
+TEST(CalDAV, GetEntryETag){
+
+ CalDAVConnectionData connNormal;
+ string currentUserPrincipal;
+
+ 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();
+
+ EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(200, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
+
+ // Check that the server supports CalDAV.
+
+ CalDAVServerSupport connSupport = serverConnection.GetServerSupport();
+ connResult = serverConnection.GetServerResult();
+
+ EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(200, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
+ ASSERT_EQ(true, connSupport.basicSupport);
+
+ // Get the list of calendars.
+
+ CalDAVCalendarList calendarList = serverConnection.GetCalendars();
+
+ // Check the response result 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 entry entity tag.
+
+ string eTagValue;
+
+ connResult = serverConnection.GetEntryETag(&entryCalendarHREFProcessing, &eTagValue);
+
+ EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(207, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
+
+}
+
+TEST(CalDAV, EditEntry){
+
+ // Check that EntryCalendarHREFProcessing is not blank.
+
+ ASSERT_NE("", entryCalendarHREFProcessing);
+
+ CalDAVConnectionData connNormal;
+ string currentUserPrincipal;
+
+ 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();
+
+ EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(200, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
+
+ // Check that the server supports CalDAV.
+
+ CalDAVServerSupport connSupport = serverConnection.GetServerSupport();
+ connResult = serverConnection.GetServerResult();
+
+ EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(200, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
+ ASSERT_EQ(true, connSupport.basicSupport);
+
+ // Get the list of calendars.
+
+ CalDAVCalendarList calendarList = serverConnection.GetCalendars();
+
+ // Check the response result 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 entry entity tag.
+
+ string eTagValue;
+
+ connResult = serverConnection.GetEntryETag(&entryCalendarHREFProcessing, &eTagValue);
+
+ EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(207, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
+
+ // Update the contact with new information.
+
+ string editEntryData = "BEGIN:VCALENDAR\n"
+ "VERSION:2.0\n"
+ "PRODID:-//Xestia//Calendar Unit Testing//KW\n"
+ "BEGIN:VEVENT\n"
+ "UID:";
+ editEntryData += entryUUID;
+ editEntryData += "\n"
+ "DTSTAMP:20160116T190200Z\n"
+ "DTSTART:20160116T190200Z\n"
+ "DTEND:20160116T190200Z\n"
+ "SUMMARY:Unit Test Event 1 which has to be a really long summary as we don't k\n"
+ " now if multiple line processing is going to work without it. I mean seriousl\n"
+ " y, how annoying can this potentially be?\n"
+ "END:VEVENT\n"
+ "END:VCALENDAR\n";
+
+ connResult = serverConnection.EditEntry(&entryCalendarHREFProcessing, &editEntryData, &eTagValue);
+
+ EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(204, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
+
+}
+
+TEST(CalDAV, DeleteEntry){
+
+ // Check that EntryCalendarHREFProcessing is not blank.
+
+ ASSERT_NE("", entryCalendarHREFProcessing);
+
+ CalDAVConnectionData connNormal;
+ string currentUserPrincipal;
+
+ 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();
+
+ EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(200, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
+
+ // Check that the server supports CalDAV.
+
+ CalDAVServerSupport connSupport = serverConnection.GetServerSupport();
+ connResult = serverConnection.GetServerResult();
+
+ EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(200, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
+ ASSERT_EQ(true, connSupport.basicSupport);
+
+ // Delete the calendar entry.
+
+ connResult = serverConnection.DeleteCalendar(&entryCalendarHREFProcessing);
+
+ // Check the response result from the server.
+
+ EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(204, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
+
+}
+
+TEST(CalDAV, GetEntryList){
+
+ // Check that EntryCalendarHREFProcessing is not blank.
+
+ ASSERT_NE("", entryCalendarHREFProcessing);
+
+ CalDAVConnectionData connNormal;
+ string currentUserPrincipal;