// xestiacalendar_caldav.h - Xestia Calendar CalDAV Object Unit Tests
//
-// (c) 2016 Xestia Software Development.
+// (c) 2016-2017 Xestia Software Development.
//
// This file is part of Xestia Calendar.
//
-// Xestia Address Book is free software: you can redistribute it and/or modify
+// Xestia Calendar is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by the
// Free Software Foundation, version 3 of the license.
//
-// Xestia Address Book is distributed in the hope that it will be useful,
+// Xestia Calendar is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
#include <map>
using namespace std;
-string EntryCalendarHREFProcessing = "";
-string EntryUUID = "";
+string entryCalendarHREFProcessing = "";
+string entryUUID = "";
TEST(CalDAV, BasicTests){
- CalDAVConnectionData ConnPlain;
- CalDAVConnectionData ConnNormal;
- CalDAVConnectionData ConnInvalidSSL;
- CalDAVConnectionData ConnTimeout;
- ProcessConnectionDataFileResult DataFileResult;
+ CalDAVConnectionData connPlain;
+ CalDAVConnectionData connNormal;
+ CalDAVConnectionData connInvalidSSL;
+ CalDAVConnectionData connTimeout;
+ ProcessConnectionDataFileResult dataFileResult;
- bool ValidDataPlain = false;
- bool ValidDataNormal = false;
- bool ValidDataInvalidSSL = false;
- bool ValidDataTimeout = false;
+ bool validDataPlain = false;
+ bool validDataNormal = false;
+ bool validDataInvalidSSL = false;
+ bool validDataTimeout = false;
// Attempt to read the caldavtest-plain.auth file.
- DataFileResult = ProcessConnectionDataFile("caldavtest-plain.auth", &ConnPlain);
- if (DataFileResult == PROCESSCONNECTIONDATAFILE_OK){
- ValidDataPlain = true;
+ dataFileResult = ProcessConnectionDataFile("caldavtest-plain.auth", &connPlain);
+ if (dataFileResult == PROCESSCONNECTIONDATAFILE_OK){
+ validDataPlain = true;
}
// Attempt to read the caldavtest.auth file.
- DataFileResult = ProcessConnectionDataFile("caldavtest.auth", &ConnNormal);
- if (DataFileResult == PROCESSCONNECTIONDATAFILE_OK){
- ValidDataNormal = true;
+ dataFileResult = ProcessConnectionDataFile("caldavtest.auth", &connNormal);
+ if (dataFileResult == PROCESSCONNECTIONDATAFILE_OK){
+ validDataNormal = true;
}
// Attempt to read the caldavtest-fail.auth file.
- DataFileResult = ProcessConnectionDataFile("caldavtest-fail.auth", &ConnInvalidSSL);
- if (DataFileResult == PROCESSCONNECTIONDATAFILE_OK){
- ValidDataInvalidSSL = true;
+ dataFileResult = ProcessConnectionDataFile("caldavtest-fail.auth", &connInvalidSSL);
+ if (dataFileResult == PROCESSCONNECTIONDATAFILE_OK){
+ validDataInvalidSSL = true;
}
// Attempt to read the caldavtest-timeout.auth file.
- DataFileResult = ProcessConnectionDataFile("caldavtest-timeout.auth", &ConnTimeout);
- if (DataFileResult == PROCESSCONNECTIONDATAFILE_OK){
- ValidDataTimeout = true;
+ dataFileResult = ProcessConnectionDataFile("caldavtest-timeout.auth", &connTimeout);
+ if (dataFileResult == PROCESSCONNECTIONDATAFILE_OK){
+ validDataTimeout = true;
}
- if (ValidDataPlain == false){
+ if (validDataPlain == false){
// Cannot read the caldavtest-plain.auth file properly.
}
- if (ValidDataNormal == false){
+ if (validDataNormal == false){
// Cannot read the caldavtest.auth file properly.
}
- if (ValidDataInvalidSSL == false){
+ if (validDataInvalidSSL == false){
// Cannot read the caldavtest-fail.auth file properly.
}
- if (ValidDataTimeout == false){
+ if (validDataTimeout == false){
// Cannot read the caldavtest-timeout.auth file properly.
}
- ASSERT_EQ(true, ValidDataPlain);
- ASSERT_EQ(true, ValidDataNormal);
- ASSERT_EQ(true, ValidDataInvalidSSL);
- ASSERT_EQ(true, ValidDataTimeout);
+ ASSERT_EQ(true, validDataPlain);
+ ASSERT_EQ(true, validDataNormal);
+ ASSERT_EQ(true, validDataInvalidSSL);
+ ASSERT_EQ(true, validDataTimeout);
// (*nix version) Setup an initial connection (just plain
// text).
- CalDAV CalDAVPlain;
- CalDAVPlain.SetupConnectionData(&ConnPlain);
+ CalDAV calDAVPlain;
+ calDAVPlain.SetupConnectionData(&connPlain);
// Verify that the settings match with the CalDAVConnectionData
// passed.
- CalDAVStatus CalDAVPlainStatus = CalDAVPlain.GetConnectionData();
+ CalDAVStatus calDAVPlainStatus = calDAVPlain.GetConnectionData();
- ASSERT_EQ(CalDAVPlainStatus.Hostname, ConnPlain.Hostname);
- ASSERT_EQ(CalDAVPlainStatus.Username, ConnPlain.Username);
- ASSERT_EQ(CalDAVPlainStatus.Port, ConnPlain.Port);
- ASSERT_EQ(CalDAVPlainStatus.Prefix, ConnPlain.Prefix);
- ASSERT_EQ(CalDAVPlainStatus.UseSSL, ConnPlain.UseSSL);
+ ASSERT_EQ(calDAVPlainStatus.hostname, connPlain.hostname);
+ ASSERT_EQ(calDAVPlainStatus.username, connPlain.username);
+ ASSERT_EQ(calDAVPlainStatus.port, connPlain.port);
+ ASSERT_EQ(calDAVPlainStatus.prefix, connPlain.prefix);
+ ASSERT_EQ(calDAVPlainStatus.useSSL, connPlain.useSSL);
// Verify that the connection was successful.
- CalDAVServerResult ConnResult = CalDAVPlain.Connect();
+ CalDAVServerResult connResult = calDAVPlain.Connect();
- ASSERT_EQ(CALDAVQUERYRESULT_OK, ConnResult.Result);
- ASSERT_EQ(200, ConnResult.HTTPCode);
- ASSERT_EQ(CURLE_OK, ConnResult.Code);
+ ASSERT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(200, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
// 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;
+ 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);
+ CalDAV calDAVPlainFail;
+ calDAVPlainFail.SetupConnectionData(&connPlainFail);
// Setup the CalDAVStatus object.
- CalDAVStatus CalDAVPlainFailStatus = CalDAVPlain.GetConnectionData();
+ CalDAVStatus calDAVPlainFailStatus = calDAVPlain.GetConnectionData();
// Connect and fail.
- ConnResult = CalDAVPlainFail.Connect();
+ connResult = calDAVPlainFail.Connect();
- ASSERT_EQ(CALDAVQUERYRESULT_SERVERERROR, ConnResult.Result);
- ASSERT_EQ(0, ConnResult.HTTPCode);
- ASSERT_EQ(CURLE_COULDNT_RESOLVE_HOST, ConnResult.Code);
+ 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).
- CalDAV CalDAVNormal;
- CalDAVNormal.SetupConnectionData(&ConnNormal);
+ CalDAV calDAVNormal;
+ calDAVNormal.SetupConnectionData(&connNormal);
// Verify that the settings match with the CalDAVConnectionData
// passed.
- CalDAVStatus CalDAVNormalStatus = CalDAVNormal.GetConnectionData();
+ CalDAVStatus calDAVNormalStatus = calDAVNormal.GetConnectionData();
- ASSERT_EQ(CalDAVNormalStatus.Hostname, ConnNormal.Hostname);
- ASSERT_EQ(CalDAVNormalStatus.Username, ConnNormal.Username);
- ASSERT_EQ(CalDAVNormalStatus.Port, ConnNormal.Port);
- ASSERT_EQ(CalDAVNormalStatus.Prefix, ConnNormal.Prefix);
- ASSERT_EQ(CalDAVNormalStatus.UseSSL, ConnNormal.UseSSL);
+ ASSERT_EQ(calDAVNormalStatus.hostname, connNormal.hostname);
+ ASSERT_EQ(calDAVNormalStatus.username, connNormal.username);
+ ASSERT_EQ(calDAVNormalStatus.port, connNormal.port);
+ ASSERT_EQ(calDAVNormalStatus.prefix, connNormal.prefix);
+ ASSERT_EQ(calDAVNormalStatus.useSSL, connNormal.useSSL);
// Verify that the connection was successful (with a valid
// SSL certificate).
- ConnResult = CalDAVNormal.Connect();
+ connResult = calDAVNormal.Connect();
- ASSERT_EQ(CALDAVQUERYRESULT_OK, ConnResult.Result);
- ASSERT_EQ(200, ConnResult.HTTPCode);
- ASSERT_EQ(CURLE_OK, ConnResult.Code);
+ ASSERT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(200, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
// (*nix version) Setup an initial connection on a server that
// will fail due to having an invalid SSL certificate.
- CalDAV CalDAVInvalidSSL;
- CalDAVInvalidSSL.SetupConnectionData(&ConnInvalidSSL);
+ CalDAV calDAVInvalidSSL;
+ calDAVInvalidSSL.SetupConnectionData(&connInvalidSSL);
// Verify that the settings match with the CalDAVConnectionData
// passed.
- CalDAVStatus CalDAVInvalidSSLStatus = CalDAVInvalidSSL.GetConnectionData();
+ CalDAVStatus calDAVInvalidSSLStatus = calDAVInvalidSSL.GetConnectionData();
- ASSERT_EQ(CalDAVInvalidSSLStatus.Hostname, ConnInvalidSSL.Hostname);
- ASSERT_EQ(CalDAVInvalidSSLStatus.Username, ConnInvalidSSL.Username);
- ASSERT_EQ(CalDAVInvalidSSLStatus.Port, ConnInvalidSSL.Port);
- ASSERT_EQ(CalDAVInvalidSSLStatus.Prefix, ConnInvalidSSL.Prefix);
- ASSERT_EQ(CalDAVInvalidSSLStatus.UseSSL, ConnInvalidSSL.UseSSL);
+ ASSERT_EQ(calDAVInvalidSSLStatus.hostname, connInvalidSSL.hostname);
+ ASSERT_EQ(calDAVInvalidSSLStatus.username, connInvalidSSL.username);
+ ASSERT_EQ(calDAVInvalidSSLStatus.port, connInvalidSSL.port);
+ ASSERT_EQ(calDAVInvalidSSLStatus.prefix, connInvalidSSL.prefix);
+ ASSERT_EQ(calDAVInvalidSSLStatus.useSSL, connInvalidSSL.useSSL);
// Verify that the connection had failed. (with an invalid
// SSL certificate).
- ConnResult = CalDAVInvalidSSL.Connect();
+ connResult = calDAVInvalidSSL.Connect();
- ASSERT_EQ(CALDAVQUERYRESULT_SERVERERROR, ConnResult.Result);
- ASSERT_EQ(0, ConnResult.HTTPCode);
- ASSERT_EQ(CURLE_SSL_CACERT, ConnResult.Code);
+ ASSERT_EQ(CALDAVQUERYRESULT_SERVERERROR, connResult.result);
+ ASSERT_EQ(0, connResult.httpCode);
+ ASSERT_EQ(CURLE_SSL_CACERT, connResult.code);
// (*nix version) Setup an inital connection on a server where
// a timeout occurs.
- ConnTimeout.Timeout = 5;
+ connTimeout.timeout = 5;
- CalDAV CalDAVTimeout;
- CalDAVTimeout.SetupConnectionData(&ConnTimeout);
+ CalDAV calDAVTimeout;
+ calDAVTimeout.SetupConnectionData(&connTimeout);
// Verify that the settings match with the CalDAVConnectionData
// passed.
- CalDAVStatus CalDAVTimeoutStatus = CalDAVTimeout.GetConnectionData();
+ 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.Timeout, ConnTimeout.Timeout);
- ASSERT_EQ(CalDAVTimeoutStatus.UseSSL, ConnTimeout.UseSSL);
+ 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.timeout, connTimeout.timeout);
+ ASSERT_EQ(calDAVTimeoutStatus.useSSL, connTimeout.useSSL);
// Verify that the connection had timed out.
- ConnResult = CalDAVTimeout.Connect();
+ connResult = calDAVTimeout.Connect();
- ASSERT_EQ(CALDAVQUERYRESULT_SERVERERROR, ConnResult.Result);
- ASSERT_EQ(0, ConnResult.HTTPCode);
- ASSERT_EQ(CURLE_OPERATION_TIMEDOUT, ConnResult.Code);
+ ASSERT_EQ(CALDAVQUERYRESULT_SERVERERROR, connResult.result);
+ ASSERT_EQ(0, connResult.httpCode);
+ ASSERT_EQ(CURLE_OPERATION_TIMEDOUT, connResult.code);
}
TEST(CalDAV, BuildServerAddress){
- CalDAVConnectionData ConnNormal;
- ProcessConnectionDataFileResult DataFileResult;
- bool ValidDataNormal = false;
+ CalDAVConnectionData connNormal;
+ ProcessConnectionDataFileResult dataFileResult;
+ bool validDataNormal = false;
// Attempt to read the caldavtest.auth file.
- DataFileResult = ProcessConnectionDataFile("caldavtest.auth", &ConnNormal);
- if (DataFileResult == PROCESSCONNECTIONDATAFILE_OK){
- ValidDataNormal = true;
+ dataFileResult = ProcessConnectionDataFile("caldavtest.auth", &connNormal);
+ if (dataFileResult == PROCESSCONNECTIONDATAFILE_OK){
+ validDataNormal = true;
}
- if (ValidDataNormal == false){
+ if (validDataNormal == false){
// Cannot read the caldavtest.auth file properly.
}
- ASSERT_EQ(true, ValidDataNormal);
+ ASSERT_EQ(true, validDataNormal);
// Setup the server address to check.
- string ServerAddress;
+ string serverAddress;
// Setup the server address.
- if (ConnNormal.UseSSL == true){
- ServerAddress += "https://";
+ if (connNormal.useSSL == true){
+ serverAddress += "https://";
} else {
- ServerAddress += "http://";
+ serverAddress += "http://";
}
- ServerAddress += ConnNormal.Hostname;
+ serverAddress += connNormal.hostname;
// Check if server port is 80, otherwise
// specifiy the port number in the address.
- if (ConnNormal.Port != 80){
- ServerAddress += ":";
- ServerAddress += to_string(ConnNormal.Port);
+ if (connNormal.port != 80){
+ serverAddress += ":";
+ serverAddress += to_string(connNormal.port);
}
- ServerAddress += "/principals/";
+ serverAddress += "/principals/";
- ASSERT_EQ(ServerAddress, BuildServerAddress(&ConnNormal, "/principals/"));
+ ASSERT_EQ(serverAddress, BuildServerAddress(&connNormal, "/principals/"));
}
TEST(CalDAV, CalendarServerSupport){
- CalDAVConnectionData ConnNormal;
+ CalDAVConnectionData connNormal;
- bool ValidDataNormal = false;
+ bool validDataNormal = false;
// Attempt to read the caldavtest.auth file.
- ProcessConnectionDataFileResult DataFileResult = ProcessConnectionDataFile("caldavtest.auth", &ConnNormal);
- if (DataFileResult == PROCESSCONNECTIONDATAFILE_OK){
- ValidDataNormal = true;
+ ProcessConnectionDataFileResult dataFileResult = ProcessConnectionDataFile("caldavtest.auth", &connNormal);
+ if (dataFileResult == PROCESSCONNECTIONDATAFILE_OK){
+ validDataNormal = true;
}
- ASSERT_EQ(true, ValidDataNormal);
+ ASSERT_EQ(true, validDataNormal);
// Setup the connection.
- CalDAV ServerConnection;
+ CalDAV serverConnection;
- ServerConnection.SetupConnectionData(&ConnNormal);
+ serverConnection.SetupConnectionData(&connNormal);
// Verify the connection settings.
- CalDAVStatus CalDAVStatus = ServerConnection.GetConnectionData();
+ 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);
+ 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();
+ CalDAVServerResult connResult = serverConnection.Connect();
- ASSERT_EQ(CALDAVQUERYRESULT_OK, ConnResult.Result);
- ASSERT_EQ(200, ConnResult.HTTPCode);
- ASSERT_EQ(CURLE_OK, ConnResult.Code);
+ 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();
+ CalDAVServerSupport connSupport = serverConnection.GetServerSupport();
- ASSERT_EQ(true, ConnSupport.BasicSupport);
+ ASSERT_EQ(true, connSupport.basicSupport);
}
TEST(CalDAV, GetCalendarHome){
- CalDAVConnectionData ConnNormal;
+ CalDAVConnectionData connNormal;
- bool ValidDataNormal = false;
+ bool validDataNormal = false;
// Attempt to read the caldavtest.auth file.
- ProcessConnectionDataFileResult DataFileResult = ProcessConnectionDataFile("caldavtest.auth", &ConnNormal);
- if (DataFileResult == PROCESSCONNECTIONDATAFILE_OK){
- ValidDataNormal = true;
+ ProcessConnectionDataFileResult dataFileResult = ProcessConnectionDataFile("caldavtest.auth", &connNormal);
+ if (dataFileResult == PROCESSCONNECTIONDATAFILE_OK){
+ validDataNormal = true;
}
- ASSERT_EQ(true, ValidDataNormal);
+ ASSERT_EQ(true, validDataNormal);
// Setup the connection.
- CalDAV ServerConnection;
+ CalDAV serverConnection;
- ServerConnection.SetupConnectionData(&ConnNormal);
+ serverConnection.SetupConnectionData(&connNormal);
// Verify the connection settings.
- CalDAVStatus CalDAVStatus = ServerConnection.GetConnectionData();
+ 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);
+ 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();
+ CalDAVServerResult connResult = serverConnection.Connect();
- ASSERT_EQ(CALDAVQUERYRESULT_OK, ConnResult.Result);
- ASSERT_EQ(200, ConnResult.HTTPCode);
- ASSERT_EQ(CURLE_OK, ConnResult.Code);
+ 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();
+ CalDAVServerSupport connSupport = serverConnection.GetServerSupport();
- ASSERT_EQ(true, ConnSupport.BasicSupport);
+ ASSERT_EQ(true, connSupport.basicSupport);
// Get the user principal.
- string CurrentUserPrincipal = ServerConnection.GetUserPrincipal();
+ string currentUserPrincipal = serverConnection.GetUserPrincipal();
// Check the response from the server.
- ConnResult = ServerConnection.GetServerResult();
+ connResult = serverConnection.GetServerResult();
- EXPECT_EQ(CALDAVQUERYRESULT_OK, ConnResult.Result);
- ASSERT_EQ(207, ConnResult.HTTPCode);
- ASSERT_EQ(CURLE_OK, ConnResult.Code);
+ 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);
+ string calendarHome = serverConnection.GetCalendarHome(currentUserPrincipal);
// Check the response from the server.
- ConnResult = ServerConnection.GetServerResult();
+ connResult = serverConnection.GetServerResult();
- EXPECT_EQ(CALDAVQUERYRESULT_OK, ConnResult.Result);
- ASSERT_EQ(207, ConnResult.HTTPCode);
- ASSERT_EQ(CURLE_OK, ConnResult.Code);
+ EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(207, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
}
TEST(CalDAV, ListCalendars){
- CalDAVConnectionData ConnNormal;
- string CurrentUserPrincipal;
+ CalDAVConnectionData connNormal;
+ string currentUserPrincipal;
- bool ValidDataNormal = false;
+ bool validDataNormal = false;
// Attempt to read the caldavtest.auth file.
- ProcessConnectionDataFileResult DataFileResult = ProcessConnectionDataFile("caldavtest.auth", &ConnNormal);
- if (DataFileResult == PROCESSCONNECTIONDATAFILE_OK){
- ValidDataNormal = true;
+ ProcessConnectionDataFileResult dataFileResult = ProcessConnectionDataFile("caldavtest.auth", &connNormal);
+ if (dataFileResult == PROCESSCONNECTIONDATAFILE_OK){
+ validDataNormal = true;
}
- ASSERT_EQ(true, ValidDataNormal);
+ ASSERT_EQ(true, validDataNormal);
// Setup the connection.
- CalDAV ServerConnection;
+ CalDAV serverConnection;
- ServerConnection.SetupConnectionData(&ConnNormal);
+ serverConnection.SetupConnectionData(&connNormal);
// Verify the connection settings.
- CalDAVStatus CalDAVStatus = ServerConnection.GetConnectionData();
+ 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);
+ 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();
+ CalDAVServerResult connResult = serverConnection.Connect();
- EXPECT_EQ(CALDAVQUERYRESULT_OK, ConnResult.Result);
- ASSERT_EQ(200, ConnResult.HTTPCode);
- ASSERT_EQ(CURLE_OK, ConnResult.Code);
+ 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();
+ 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);
+ 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();
+ CalDAVCalendarList calendarList = serverConnection.GetCalendars();
// Check the response result from the server.
- ConnResult = ServerConnection.GetServerResult();
+ connResult = serverConnection.GetServerResult();
- EXPECT_EQ(CALDAVQUERYRESULT_OK, ConnResult.Result);
- ASSERT_EQ(207, ConnResult.HTTPCode);
- ASSERT_EQ(CURLE_OK, ConnResult.Code);
+ EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(207, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
}
TEST(CalDAV, AddCalendar){
- CalDAVConnectionData ConnNormal;
- string CurrentUserPrincipal;
+ CalDAVConnectionData connNormal;
+ string currentUserPrincipal;
- bool ValidDataNormal = false;
+ bool validDataNormal = false;
// Attempt to read the caldavtest.auth file.
- ProcessConnectionDataFileResult DataFileResult = ProcessConnectionDataFile("caldavtest.auth", &ConnNormal);
- if (DataFileResult == PROCESSCONNECTIONDATAFILE_OK){
- ValidDataNormal = true;
+ ProcessConnectionDataFileResult dataFileResult = ProcessConnectionDataFile("caldavtest.auth", &connNormal);
+ if (dataFileResult == PROCESSCONNECTIONDATAFILE_OK){
+ validDataNormal = true;
}
- ASSERT_EQ(true, ValidDataNormal);
+ ASSERT_EQ(true, validDataNormal);
// Setup the connection.
- CalDAV ServerConnection;
+ CalDAV serverConnection;
- ServerConnection.SetupConnectionData(&ConnNormal);
+ serverConnection.SetupConnectionData(&connNormal);
// Verify the connection settings.
- CalDAVStatus CalDAVStatus = ServerConnection.GetConnectionData();
+ 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);
+ 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();
+ CalDAVServerResult connResult = serverConnection.Connect();
- EXPECT_EQ(CALDAVQUERYRESULT_OK, ConnResult.Result);
- ASSERT_EQ(200, ConnResult.HTTPCode);
- ASSERT_EQ(CURLE_OK, ConnResult.Code);
+ 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");
+ connResult = serverConnection.AddCalendar("New Calendar");
- EXPECT_EQ(CALDAVQUERYRESULT_OK, ConnResult.Result);
- ASSERT_EQ(201, ConnResult.HTTPCode);
- ASSERT_EQ(CURLE_OK, ConnResult.Code);
+ EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(201, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
}
TEST(CalDAV, EditCalendar){
- CalDAVConnectionData ConnNormal;
- string CurrentUserPrincipal;
+ CalDAVConnectionData connNormal;
+ string currentUserPrincipal;
- bool ValidDataNormal = false;
+ bool validDataNormal = false;
// Attempt to read the caldavtest.auth file.
- ProcessConnectionDataFileResult DataFileResult = ProcessConnectionDataFile("caldavtest.auth", &ConnNormal);
- if (DataFileResult == PROCESSCONNECTIONDATAFILE_OK){
- ValidDataNormal = true;
+ ProcessConnectionDataFileResult dataFileResult = ProcessConnectionDataFile("caldavtest.auth", &connNormal);
+ if (dataFileResult == PROCESSCONNECTIONDATAFILE_OK){
+ validDataNormal = true;
}
- ASSERT_EQ(true, ValidDataNormal);
+ ASSERT_EQ(true, validDataNormal);
// Setup the connection.
- CalDAV ServerConnection;
+ CalDAV serverConnection;
- ServerConnection.SetupConnectionData(&ConnNormal);
+ serverConnection.SetupConnectionData(&connNormal);
// Verify the connection settings.
- CalDAVStatus CalDAVStatus = ServerConnection.GetConnectionData();
+ 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);
+ 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();
+ CalDAVServerResult connResult = serverConnection.Connect();
- EXPECT_EQ(CALDAVQUERYRESULT_OK, ConnResult.Result);
- ASSERT_EQ(200, ConnResult.HTTPCode);
- ASSERT_EQ(CURLE_OK, ConnResult.Code);
+ 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();
+ 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);
+ 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");
+ connResult = serverConnection.AddCalendar("Calendar To Edit");
- EXPECT_EQ(CALDAVQUERYRESULT_OK, ConnResult.Result);
- ASSERT_EQ(201, ConnResult.HTTPCode);
- ASSERT_EQ(CURLE_OK, ConnResult.Code);
+ 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();
+ CalDAVCalendarList calendarList = serverConnection.GetCalendars();
// Check the response result from the server.
- ConnResult = ServerConnection.GetServerResult();
+ connResult = serverConnection.GetServerResult();
- EXPECT_EQ(CALDAVQUERYRESULT_OK, ConnResult.Result);
- ASSERT_EQ(207, ConnResult.HTTPCode);
- ASSERT_EQ(CURLE_OK, ConnResult.Code);
+ 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;
+ int itemSeek = 0;
+ bool itemFound = false;
- for (map<int,string>::iterator CalendarNameIter = CalendarList.Name.begin();
- CalendarNameIter != CalendarList.Name.end(); CalendarNameIter++){
+ for (map<int,string>::iterator calendarNameIter = calendarList.name.begin();
+ calendarNameIter != calendarList.name.end(); calendarNameIter++){
- if (CalendarNameIter->second == "Calendar To Edit"){
- ItemFound = true;
+ if (calendarNameIter->second == "Calendar To Edit"){
+ itemFound = true;
break;
}
- ItemSeek++;
+ itemSeek++;
}
- ASSERT_NE(false, ItemFound);
+ ASSERT_NE(false, itemFound);
// Edit the name of the calendar.
- string CalendarEditHREF = CalendarList.HREF[ItemSeek];
- string NewCalendarName = "Edited Calendar";
+ string calendarEditHREF = calendarList.href[itemSeek];
+ string newCalendarName = "Edited Calendar";
- ConnResult = ServerConnection.EditCalendar(&CalendarEditHREF, &NewCalendarName);
+ connResult = serverConnection.EditCalendar(&calendarEditHREF, &newCalendarName);
- EXPECT_EQ(CALDAVQUERYRESULT_OK, ConnResult.Result);
- ASSERT_EQ(207, ConnResult.HTTPCode);
- ASSERT_EQ(CURLE_OK, ConnResult.Code);
+ 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;
+ Colour newColour;
- NewColour.red = 255;
- NewColour.green = 0;
- NewColour.blue = 0;
- NewColour.alpha = 0;
+ newColour.red = 255;
+ newColour.green = 0;
+ newColour.blue = 0;
+ newColour.alpha = 0;
- ConnResult = ServerConnection.EditCalendar(&CalendarEditHREF, &NewColour);
+ connResult = serverConnection.EditCalendar(&calendarEditHREF, &newColour);
- EXPECT_EQ(CALDAVQUERYRESULT_OK, ConnResult.Result);
- ASSERT_EQ(207, ConnResult.HTTPCode);
- ASSERT_EQ(CURLE_OK, ConnResult.Code);
+ 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";
+ string newCalendarDescription = "Update Calendar Description";
- ConnResult = ServerConnection.EditCalendarDescription(&CalendarEditHREF, &NewCalendarDescription);
+ connResult = serverConnection.EditCalendarDescription(&calendarEditHREF, &newCalendarDescription);
- EXPECT_EQ(CALDAVQUERYRESULT_OK, ConnResult.Result);
- ASSERT_EQ(207, ConnResult.HTTPCode);
- ASSERT_EQ(CURLE_OK, ConnResult.Code);
+ 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;
+ int newCalendarOrder = 30;
- ConnResult = ServerConnection.EditCalendar(&CalendarEditHREF, &NewCalendarOrder);
+ connResult = serverConnection.EditCalendar(&calendarEditHREF, &newCalendarOrder);
- EXPECT_EQ(CALDAVQUERYRESULT_OK, ConnResult.Result);
- ASSERT_EQ(207, ConnResult.HTTPCode);
- ASSERT_EQ(CURLE_OK, ConnResult.Code);
+ 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;
+ 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);
+ 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);
+ EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(207, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
}
TEST(CalDAV, DeleteCalendar){
- CalDAVConnectionData ConnNormal;
- string CurrentUserPrincipal;
+ CalDAVConnectionData connNormal;
+ string currentUserPrincipal;
- bool ValidDataNormal = false;
+ bool validDataNormal = false;
// Attempt to read the caldavtest.auth file.
- ProcessConnectionDataFileResult DataFileResult = ProcessConnectionDataFile("caldavtest.auth", &ConnNormal);
- if (DataFileResult == PROCESSCONNECTIONDATAFILE_OK){
- ValidDataNormal = true;
+ ProcessConnectionDataFileResult dataFileResult = ProcessConnectionDataFile("caldavtest.auth", &connNormal);
+ if (dataFileResult == PROCESSCONNECTIONDATAFILE_OK){
+ validDataNormal = true;
}
- ASSERT_EQ(true, ValidDataNormal);
+ ASSERT_EQ(true, validDataNormal);
// Setup the connection.
- CalDAV ServerConnection;
+ CalDAV serverConnection;
- ServerConnection.SetupConnectionData(&ConnNormal);
+ serverConnection.SetupConnectionData(&connNormal);
// Verify the connection settings.
- CalDAVStatus CalDAVStatus = ServerConnection.GetConnectionData();
+ 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);
+ 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();
+ CalDAVServerResult connResult = serverConnection.Connect();
- EXPECT_EQ(CALDAVQUERYRESULT_OK, ConnResult.Result);
- ASSERT_EQ(200, ConnResult.HTTPCode);
- ASSERT_EQ(CURLE_OK, ConnResult.Code);
+ 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();
+ 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);
+ 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();
+ CalDAVCalendarList calendarList = serverConnection.GetCalendars();
// Check the response result from the server.
- ConnResult = ServerConnection.GetServerResult();
+ connResult = serverConnection.GetServerResult();
- EXPECT_EQ(CALDAVQUERYRESULT_OK, ConnResult.Result);
- ASSERT_EQ(207, ConnResult.HTTPCode);
- ASSERT_EQ(CURLE_OK, ConnResult.Code);
+ 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;
+ int itemSeek = 0;
+ bool itemFound = false;
- for (map<int,string>::iterator CalendarNameIter = CalendarList.Name.begin();
- CalendarNameIter != CalendarList.Name.end(); CalendarNameIter++){
+ for (map<int,string>::iterator calendarNameIter = calendarList.name.begin();
+ calendarNameIter != calendarList.name.end(); calendarNameIter++){
- if (CalendarNameIter->second == "Calendar Edited Again"){
- ItemFound = true;
+ if (calendarNameIter->second == "Calendar Edited Again"){
+ itemFound = true;
break;
}
- ItemSeek++;
+ itemSeek++;
}
- ASSERT_NE(false, ItemFound);
+ ASSERT_NE(false, itemFound);
// Delete some calendars.
- string CalendarEditHREF = CalendarList.HREF[ItemSeek];
+ string calendarEditHREF = calendarList.href[itemSeek];
- ConnResult = ServerConnection.DeleteCalendar(&CalendarEditHREF);
+ connResult = serverConnection.DeleteCalendar(&calendarEditHREF);
- EXPECT_EQ(CALDAVQUERYRESULT_OK, ConnResult.Result);
- ASSERT_EQ(204, ConnResult.HTTPCode);
- ASSERT_EQ(CURLE_OK, ConnResult.Code);
+ EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(204, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
}
TEST(CalDAV, AddEntry){
- CalDAVConnectionData ConnNormal;
- string CurrentUserPrincipal;
+ CalDAVConnectionData connNormal;
+ string currentUserPrincipal;
- bool ValidDataNormal = false;
+ bool validDataNormal = false;
// Attempt to read the caldavtest.auth file.
- ProcessConnectionDataFileResult DataFileResult = ProcessConnectionDataFile("caldavtest.auth", &ConnNormal);
- if (DataFileResult == PROCESSCONNECTIONDATAFILE_OK){
- ValidDataNormal = true;
+ ProcessConnectionDataFileResult dataFileResult = ProcessConnectionDataFile("caldavtest.auth", &connNormal);
+ if (dataFileResult == PROCESSCONNECTIONDATAFILE_OK){
+ validDataNormal = true;
}
- ASSERT_EQ(true, ValidDataNormal);
+ ASSERT_EQ(true, validDataNormal);
// Setup the connection.
- CalDAV ServerConnection;
+ CalDAV serverConnection;
- ServerConnection.SetupConnectionData(&ConnNormal);
+ serverConnection.SetupConnectionData(&connNormal);
// Verify the connection settings.
- CalDAVStatus CalDAVStatus = ServerConnection.GetConnectionData();
+ 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);
+ 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();
+ CalDAVServerResult connResult = serverConnection.Connect();
- EXPECT_EQ(CALDAVQUERYRESULT_OK, ConnResult.Result);
- ASSERT_EQ(200, ConnResult.HTTPCode);
- ASSERT_EQ(CURLE_OK, ConnResult.Code);
+ 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();
+ 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);
+ 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();
+ CalDAVCalendarList calendarList = serverConnection.GetCalendars();
// Check the response result from the server.
- ConnResult = ServerConnection.GetServerResult();
+ connResult = serverConnection.GetServerResult();
- EXPECT_EQ(CALDAVQUERYRESULT_OK, ConnResult.Result);
- ASSERT_EQ(207, ConnResult.HTTPCode);
- ASSERT_EQ(CURLE_OK, ConnResult.Code);
+ 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;
+ int itemSeek = 0;
+ bool itemFound = false;
- for (map<int,string>::iterator CalendarNameIter = CalendarList.Name.begin();
- CalendarNameIter != CalendarList.Name.end(); CalendarNameIter++){
+ for (map<int,string>::iterator calendarNameIter = calendarList.name.begin();
+ calendarNameIter != calendarList.name.end(); calendarNameIter++){
- if (CalendarNameIter->second == "Scratching Calendar"){
- ItemFound = true;
+ if (calendarNameIter->second == "Scratching Calendar"){
+ itemFound = true;
break;
}
- ItemSeek++;
+ itemSeek++;
}
- ASSERT_NE(false, ItemFound);
+ ASSERT_NE(false, itemFound);
- string EntryAddHREF = CalendarList.HREF[ItemSeek];
+ string entryAddHREF = calendarList.href[itemSeek];
- EntryUUID = GenerateUUID();
- EntryUUID.erase(EntryUUID.end()-1);
+ entryUUID = GenerateUUID();
+ entryUUID.erase(entryUUID.end()-1);
- EntryAddHREF.append(EntryUUID);
- EntryAddHREF.append(".ics");
+ entryAddHREF.append(entryUUID);
+ entryAddHREF.append(".ics");
- string AddEntryData = "BEGIN:VCALENDAR\n"
+ string addEntryData = "BEGIN:VCALENDAR\n"
"VERSION:2.0\n"
"PRODID:-//Xestia//Calendar Unit Testing//KW\n"
"BEGIN:VEVENT\n"
"UID:";
- AddEntryData += EntryUUID;
- AddEntryData += "\n"
+ addEntryData += entryUUID;
+ addEntryData += "\n"
"DTSTAMP:20160116T190200Z\n"
"DTSTART:20160116T190200Z\n"
"DTEND:20160116T190200Z\n"
"END:VEVENT\n"
"END:VCALENDAR\n";
- ConnResult = ServerConnection.AddEntry(&EntryAddHREF, &AddEntryData);
+ connResult = serverConnection.AddEntry(&entryAddHREF, &addEntryData);
- EXPECT_EQ(CALDAVQUERYRESULT_OK, ConnResult.Result);
- ASSERT_EQ(201, ConnResult.HTTPCode);
- ASSERT_EQ(CURLE_OK, ConnResult.Code);
+ 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;
+ entryCalendarHREFProcessing = entryAddHREF;
}
TEST(CalDAV, GetEntryETag){
- CalDAVConnectionData ConnNormal;
- string CurrentUserPrincipal;
+ CalDAVConnectionData connNormal;
+ string currentUserPrincipal;
- bool ValidDataNormal = false;
+ bool validDataNormal = false;
// Attempt to read the caldavtest.auth file.
- ProcessConnectionDataFileResult DataFileResult = ProcessConnectionDataFile("caldavtest.auth", &ConnNormal);
- if (DataFileResult == PROCESSCONNECTIONDATAFILE_OK){
- ValidDataNormal = true;
+ ProcessConnectionDataFileResult dataFileResult = ProcessConnectionDataFile("caldavtest.auth", &connNormal);
+ if (dataFileResult == PROCESSCONNECTIONDATAFILE_OK){
+ validDataNormal = true;
}
- ASSERT_EQ(true, ValidDataNormal);
+ ASSERT_EQ(true, validDataNormal);
// Setup the connection.
- CalDAV ServerConnection;
+ CalDAV serverConnection;
- ServerConnection.SetupConnectionData(&ConnNormal);
+ serverConnection.SetupConnectionData(&connNormal);
// Verify the connection settings.
- CalDAVStatus CalDAVStatus = ServerConnection.GetConnectionData();
+ 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);
+ 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();
+ CalDAVServerResult connResult = serverConnection.Connect();
- EXPECT_EQ(CALDAVQUERYRESULT_OK, ConnResult.Result);
- ASSERT_EQ(200, ConnResult.HTTPCode);
- ASSERT_EQ(CURLE_OK, ConnResult.Code);
+ 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();
+ 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);
+ 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();
+ CalDAVCalendarList calendarList = serverConnection.GetCalendars();
// Check the response result from the server.
- ConnResult = ServerConnection.GetServerResult();
+ connResult = serverConnection.GetServerResult();
- EXPECT_EQ(CALDAVQUERYRESULT_OK, ConnResult.Result);
- ASSERT_EQ(207, ConnResult.HTTPCode);
- ASSERT_EQ(CURLE_OK, ConnResult.Code);
+ EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(207, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
- string ETagValue;
+ // Get the entry entity tag.
+
+ string eTagValue;
- ConnResult = ServerConnection.GetEntryETag(&EntryCalendarHREFProcessing, &ETagValue);
+ connResult = serverConnection.GetEntryETag(&entryCalendarHREFProcessing, &eTagValue);
- EXPECT_EQ(CALDAVQUERYRESULT_OK, ConnResult.Result);
- ASSERT_EQ(207, ConnResult.HTTPCode);
- ASSERT_EQ(CURLE_OK, ConnResult.Code);
+ EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(207, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
}
// Check that EntryCalendarHREFProcessing is not blank.
- ASSERT_NE("", EntryCalendarHREFProcessing);
+ ASSERT_NE("", entryCalendarHREFProcessing);
- CalDAVConnectionData ConnNormal;
- string CurrentUserPrincipal;
+ CalDAVConnectionData connNormal;
+ string currentUserPrincipal;
- bool ValidDataNormal = false;
+ bool validDataNormal = false;
// Attempt to read the caldavtest.auth file.
- ProcessConnectionDataFileResult DataFileResult = ProcessConnectionDataFile("caldavtest.auth", &ConnNormal);
- if (DataFileResult == PROCESSCONNECTIONDATAFILE_OK){
- ValidDataNormal = true;
+ ProcessConnectionDataFileResult dataFileResult = ProcessConnectionDataFile("caldavtest.auth", &connNormal);
+ if (dataFileResult == PROCESSCONNECTIONDATAFILE_OK){
+ validDataNormal = true;
}
- ASSERT_EQ(true, ValidDataNormal);
+ ASSERT_EQ(true, validDataNormal);
// Setup the connection.
- CalDAV ServerConnection;
+ CalDAV serverConnection;
- ServerConnection.SetupConnectionData(&ConnNormal);
+ serverConnection.SetupConnectionData(&connNormal);
// Verify the connection settings.
- CalDAVStatus CalDAVStatus = ServerConnection.GetConnectionData();
+ 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);
+ 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();
+ CalDAVServerResult connResult = serverConnection.Connect();
- EXPECT_EQ(CALDAVQUERYRESULT_OK, ConnResult.Result);
- ASSERT_EQ(200, ConnResult.HTTPCode);
- ASSERT_EQ(CURLE_OK, ConnResult.Code);
+ 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();
+ 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);
+ 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();
+ CalDAVCalendarList calendarList = serverConnection.GetCalendars();
// Check the response result from the server.
- ConnResult = ServerConnection.GetServerResult();
+ connResult = serverConnection.GetServerResult();
- EXPECT_EQ(CALDAVQUERYRESULT_OK, ConnResult.Result);
- ASSERT_EQ(207, ConnResult.HTTPCode);
- ASSERT_EQ(CURLE_OK, ConnResult.Code);
+ EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(207, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
// Get the entry entity tag.
- string ETagValue;
+ string eTagValue;
- ConnResult = ServerConnection.GetEntryETag(&EntryCalendarHREFProcessing, &ETagValue);
+ connResult = serverConnection.GetEntryETag(&entryCalendarHREFProcessing, &eTagValue);
- EXPECT_EQ(CALDAVQUERYRESULT_OK, ConnResult.Result);
- ASSERT_EQ(207, ConnResult.HTTPCode);
- ASSERT_EQ(CURLE_OK, ConnResult.Code);
+ 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"
+ string editEntryData = "BEGIN:VCALENDAR\n"
"VERSION:2.0\n"
"PRODID:-//Xestia//Calendar Unit Testing//KW\n"
"BEGIN:VEVENT\n"
"UID:";
- EditEntryData += EntryUUID;
- EditEntryData += "\n"
+ editEntryData += entryUUID;
+ editEntryData += "\n"
"DTSTAMP:20160116T190200Z\n"
"DTSTART:20160116T190200Z\n"
"DTEND:20160116T190200Z\n"
"END:VEVENT\n"
"END:VCALENDAR\n";
- ConnResult = ServerConnection.EditEntry(&EntryCalendarHREFProcessing, &EditEntryData, &ETagValue);
+ connResult = serverConnection.EditEntry(&entryCalendarHREFProcessing, &editEntryData, &eTagValue);
- EXPECT_EQ(CALDAVQUERYRESULT_OK, ConnResult.Result);
- ASSERT_EQ(204, ConnResult.HTTPCode);
- ASSERT_EQ(CURLE_OK, ConnResult.Code);
+ EXPECT_EQ(CALDAVQUERYRESULT_OK, connResult.result);
+ ASSERT_EQ(204, connResult.httpCode);
+ ASSERT_EQ(CURLE_OK, connResult.code);
}
// Check that EntryCalendarHREFProcessing is not blank.
- ASSERT_NE("", EntryCalendarHREFProcessing);
+ ASSERT_NE("", entryCalendarHREFProcessing);
- CalDAVConnectionData ConnNormal;
- string CurrentUserPrincipal;
+ CalDAVConnectionData connNormal;
+ string currentUserPrincipal;
- bool ValidDataNormal = false;
+ bool validDataNormal = false;
// Attempt to read the caldavtest.auth file.
- ProcessConnectionDataFileResult DataFileResult = ProcessConnectionDataFile("caldavtest.auth", &ConnNormal);
- if (DataFileResult == PROCESSCONNECTIONDATAFILE_OK){
- ValidDataNormal = true;
+ ProcessConnectionDataFileResult dataFileResult = ProcessConnectionDataFile("caldavtest.auth", &connNormal);
+ if (dataFileResult == PROCESSCONNECTIONDATAFILE_OK){
+ validDataNormal = true;
}
- ASSERT_EQ(true, ValidDataNormal);
+ ASSERT_EQ(true, validDataNormal);
// Setup the connection.
- CalDAV ServerConnection;
+ CalDAV serverConnection;
- ServerConnection.SetupConnectionData(&ConnNormal);
+ serverConnection.SetupConnectionData(&connNormal);
// Verify the connection settings.
- CalDAVStatus CalDAVStatus = ServerConnection.GetConnectionData();
+ 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);
+ 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();
+ CalDAVServerResult connResult = serverConnection.Connect();
- EXPECT_EQ(CALDAVQUERYRESULT_OK, ConnResult.Result);
- ASSERT_EQ(200, ConnResult.HTTPCode);
- ASSERT_EQ(CURLE_OK, ConnResult.Code);
+ 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();
+ 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);
+ 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);
+ 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);
+ 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;
+
+ 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 user principal.
+
+ string userPrincipalURI = serverConnection.GetUserPrincipal();
+
+ // Get the calendar home.
+ string calendarHomeURL = serverConnection.GetCalendarHome(userPrincipalURI);
+
+ string calendarHREF = calendarHomeURL;
+ calendarHREF += "unittestcal/";
+
+ // Get the entry list without a calendar tag set.
+
+ CalDAVEntryList entryList = serverConnection.GetEntryList(&calendarHREF);
+
+ EXPECT_GE(entryList.href.size(), 1);
+
+ // Get the list of calendars.
+
+ CalDAVCalendarList calendarList = serverConnection.GetCalendars();
+
+ string calendarTagURL = "";
+
+ for (std::map<int,string>::iterator calHREFIter = calendarList.href.begin();
+ calHREFIter != calendarList.href.end(); calHREFIter++){
+
+ if (calHREFIter->second.substr(calHREFIter->second.length() - 13) == "/unittestcal/"){
+
+ calendarTagURL = calendarList.tagURL.find(calHREFIter->first)->second;
+
+ }
+
+ }
+
+ // Get the entry list without a calendar tag set (shouldn't be empty).
+
+ entryList = serverConnection.GetEntryList(&calendarHREF, nullptr);
+
+ EXPECT_GE(entryList.href.size(), 1);
+
+ // Get the entry list with a calendar tag set (should be empty).
+
+ entryList = serverConnection.GetEntryList(&calendarHREF, &calendarTagURL);
+
+ EXPECT_EQ(entryList.href.size(), 0);
+
}
\ No newline at end of file