// xestiacalendar_caldav.h - Xestia Calendar CalDAV Object Unit Tests // // (c) 2016 Xestia Software Development. // // This file is part of Xestia Calendar. // // Xestia Address Book 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, // 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. // // You should have received a copy of the GNU General Public License along // with Xestia Calendar. If not, see #include "../objects/CalDAV/CalDAV.h" #include "xestiacalendar_testcommon.h" #include #include using namespace std; TEST(CalDAV, BasicTests){ CalDAVConnectionData ConnPlain; CalDAVConnectionData ConnNormal; CalDAVConnectionData ConnFail; CalDAVConnectionData ConnTimeout; ProcessConnectionDataFileResult DataFileResult; bool ValidDataPlain = false; bool ValidDataNormal = false; bool ValidDataFail = false; bool ValidDataTimeout = false; // Attempt to read the caldavtest-plain.auth file. 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; } // Attempt to read the caldavtest-fail.auth file. DataFileResult = ProcessConnectionDataFile("caldavtest-fail.auth", &ConnFail); if (DataFileResult == PROCESSCONNECTIONDATAFILE_OK){ ValidDataFail = true; } // Attempt to read the caldavtest-timeout.auth file. DataFileResult = ProcessConnectionDataFile("caldavtest-fail.auth", &ConnTimeout); if (DataFileResult == PROCESSCONNECTIONDATAFILE_OK){ ValidDataTimeout = true; } if (ValidDataPlain == false){ // Cannot read the caldavtest-plain.auth file properly. cout << "The caldavtest-plain.auth file does not exist or is invalid!" << endl; cout << "Please create the caldavtest-plain.auth file using the following format:" << endl << endl; cout << "server=localname" << endl; cout << "port=8080" << endl; cout << "user=username" << endl; cout << "pass=password" << endl; cout << "ssl=false" << endl; cout << "prefix=/lalala/lookatme/thisisa/prefix" << endl << endl; } if (ValidDataNormal == false){ // Cannot read the caldavtest.auth file properly. cout << "The caldavtest.auth file does not exist or is invalid!" << endl; cout << "Please create the caldavtest.auth file using the following format:" << endl << endl; cout << "server=localname" << endl; cout << "port=8080" << endl; cout << "user=username" << endl; cout << "pass=password" << endl; cout << "ssl=false" << endl; cout << "prefix=/lalala/lookatme/thisisa/prefix" << endl << endl; } if (ValidDataFail == false){ // Cannot read the caldavtest-fail.auth file properly. cout << "The caldavtest-fail.auth file does not exist or is invalid!" << endl; cout << "Please create the caldavtest-fail.auth file using the following format:" << endl << endl; cout << "server=fail.localname" << endl; cout << "port=8080" << endl; cout << "user=username" << endl; cout << "pass=password" << endl; cout << "ssl=false" << endl; cout << "prefix=/lalala/lookatme/thisisa/prefix" << endl << endl; } if (ValidDataTimeout == false){ // Cannot read the caldavtest-timeout.auth file properly. cout << "The caldavtest-timeout.auth file does not exist or is invalid!" << endl; cout << "Please create the caldavtest-timeout.auth file using the following format:" << endl << endl; cout << "server=fail.localname" << endl; cout << "port=8080" << endl; cout << "user=username" << endl; cout << "pass=password" << endl; cout << "ssl=false" << endl; cout << "prefix=/lalala/lookatme/thisisa/prefix" << endl << endl; } ASSERT_EQ(true, ValidDataPlain); ASSERT_EQ(true, ValidDataNormal); ASSERT_EQ(true, ValidDataFail); ASSERT_EQ(true, ValidDataTimeout); // (*nix version) Setup an initial connection (just plain // text). // Verify that the connection was successful. // (*nix version) Setup an initial connection (with a valid // SSL certificate). // Verify that the connection was successful (with a valid // SSL certificate). // (*nix version) Setup an initial connection on a server that // will fail due to having an invalid SSL certificate. // Verify that the connection had failed. (with an invalid // SSL certificate). // (*nix version) Setup an inital connection on a server where // a timeout occurs. // Verify that the connection had timed out. }