Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
TODOs: Remove TODOs no longer needed from code
[xestiaab/.git] / source / tests / xestiaab_carddav.cpp
index eb9acf5..6dd7bab 100644 (file)
@@ -18,8 +18,8 @@
 
 #include <gtest/gtest.h>
 #include "classes/FakeConnectionObject.h"
-
-// TODO: Add tests for the CardDAV object.
+#include <chrono>
+#include <thread>
 
 TEST(CardDAV, Use_Fake_To_Setup_And_Check_Connection_Settings_With_TestMode_True){
        
@@ -39,6 +39,10 @@ TEST(CardDAV, Use_Fake_To_Setup_And_Check_Connection_Settings_With_TestMode_True
        FakeConnectionObject FakeConnection2(ServerAddress2, 8800, ServerUser2, ServerPass2, true);
        FakeConnectionObject FakeConnection3(ServerAddress3, 8008, ServerUser3, ServerPass3, false);
        
+       FakeConnection1.ResultTestMode = true;
+       FakeConnection2.ResultTestMode = true;
+       FakeConnection3.ResultTestMode = true;
+       
        EXPECT_EQ("gibberish.invalid", FakeConnection1.GetServerAddress());
        EXPECT_EQ(8080, FakeConnection1.GetServerPort());
        EXPECT_EQ("user", FakeConnection1.GetServerUser());
@@ -86,6 +90,10 @@ TEST(CardDAV, Use_Fake_To_Setup_And_Check_Connection_Settings_With_TestMode_Fals
        FakeConnectionObject FakeConnection2(ServerAddress2, 8800, ServerUser2, ServerPass2, true, "/prefix2", "Account2");
        FakeConnectionObject FakeConnection3(ServerAddress3, 8008, ServerUser3, ServerPass3, false, "/prefix3", "Account3");
        
+       FakeConnection1.ResultTestMode = false;
+       FakeConnection2.ResultTestMode = false;
+       FakeConnection3.ResultTestMode = false;
+       
        EXPECT_EQ("gibberish.invalid", FakeConnection1.GetServerAddress());
        EXPECT_EQ(8080, FakeConnection1.GetServerPort());
        EXPECT_EQ("user", FakeConnection1.GetServerUser());
@@ -124,7 +132,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_Returning_Success){
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true);
        FakeConnection.ResultStatus = COCONNECT_OK;
        
-       EXPECT_EQ(COCONNECT_OK, FakeConnection.Connect());
+       EXPECT_EQ(COCONNECT_OK, FakeConnection.Connect(false));
        
 }
 
@@ -137,7 +145,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_Returning_InvalidAddress){
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true);
        FakeConnection.ResultStatus = COCONNECT_INVALID;
        
-       EXPECT_EQ(COCONNECT_INVALID, FakeConnection.Connect());
+       EXPECT_EQ(COCONNECT_INVALID, FakeConnection.Connect(false));
        
 }
 
@@ -150,7 +158,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_Returning_Timeout){
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true);
        FakeConnection.ResultStatus = COCONNECT_TIMEOUT;
        
-       EXPECT_EQ(COCONNECT_TIMEOUT, FakeConnection.Connect());
+       EXPECT_EQ(COCONNECT_TIMEOUT, FakeConnection.Connect(false));
        
 }
 
@@ -163,7 +171,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_Returning_Authentication_Failure
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true);
        FakeConnection.ResultStatus = COCONNECT_AUTHFAIL;
        
-       EXPECT_EQ(COCONNECT_AUTHFAIL, FakeConnection.Connect());
+       EXPECT_EQ(COCONNECT_AUTHFAIL, FakeConnection.Connect(false));
        
 }
 
@@ -175,7 +183,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Is_Able_To_Login){
        
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true);
        FakeConnection.ResultAuthPassed = true;
-       FakeConnection.Connect();
+       FakeConnection.Connect(false);
        
        EXPECT_EQ(true, FakeConnection.AbleToLogin());
        
@@ -189,7 +197,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Is_Unable_To_Login){
        
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true);
        FakeConnection.ResultAuthPassed = false;
-       FakeConnection.Connect();
+       FakeConnection.Connect(false);
        
        EXPECT_EQ(false, FakeConnection.AbleToLogin());
        
@@ -203,7 +211,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Can_Do_Processing){
        
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true);
        FakeConnection.ResultCanProcess = true;
-       FakeConnection.Connect();
+       FakeConnection.Connect(false);
        
        EXPECT_EQ(true, FakeConnection.CanDoProcessing());
        
@@ -217,7 +225,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Supports_SSL){
        
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true);
        FakeConnection.ResultSSLStatus  = true;
-       FakeConnection.Connect();
+       FakeConnection.Connect(false);
        
        EXPECT_EQ(true, FakeConnection.CanDoSSL());
        
@@ -231,7 +239,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Does_Not_Support_SSL){
        
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true);
        FakeConnection.ResultSSLStatus  = false;
-       FakeConnection.Connect();
+       FakeConnection.Connect(false);
        
        EXPECT_EQ(false, FakeConnection.CanDoSSL());
        
@@ -244,10 +252,10 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Has_Valid_SSL_Certificate_D
        std::string ServerPass1 = "pass";
        
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true);
-       FakeConnection.ResultSSLVerified = true;
-       FakeConnection.Connect();
+       FakeConnection.ResultSSLVerified = COSSL_VERIFIED;
+       FakeConnection.Connect(false);
        
-       EXPECT_EQ(true, FakeConnection.SSLVerify());
+       EXPECT_EQ(COSSL_VERIFIED, FakeConnection.SSLVerify());
        
 }
 
@@ -258,10 +266,39 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Has_Invalid_SSL_Certificate
        std::string ServerPass1 = "pass";
        
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true);
-       FakeConnection.ResultSSLVerified = false;
-       FakeConnection.Connect();
+       FakeConnection.ResultSSLVerified = COSSL_UNABLETOVERIFY;
+       FakeConnection.ResultStatus = COCONNECT_SSLFAIL;
+       
+       EXPECT_EQ(COCONNECT_SSLFAIL, FakeConnection.Connect(false));
+       EXPECT_EQ(COSSL_UNABLETOVERIFY, FakeConnection.SSLVerify());
+       
+}
+
+TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Has_User_Verified_SSL_Cerficiate_Data){
+       
+       std::string ServerAddress1 = "gibberish.invalid";
+       std::string ServerUser1 = "user";
+       std::string ServerPass1 = "pass";
+       
+       FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true);
+       FakeConnection.ResultSSLVerified = COSSL_VERIFIED_USER;
+       FakeConnection.Connect(false);
+       
+       EXPECT_EQ(COSSL_VERIFIED_USER, FakeConnection.SSLVerify());
+       
+}
+
+TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Doesnt_Use_SSL_Return_Not_Applicable_SSL_Result){
        
-       EXPECT_EQ(false, FakeConnection.SSLVerify());
+       std::string ServerAddress1 = "gibberish.invalid";
+       std::string ServerUser1 = "user";
+       std::string ServerPass1 = "pass";
+       
+       FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, false);
+       FakeConnection.ResultSSLVerified = COSSL_NOTAPPLICABLE;
+       FakeConnection.Connect(false);
+       
+       EXPECT_EQ(COSSL_NOTAPPLICABLE, FakeConnection.SSLVerify());
        
 }
 
@@ -273,7 +310,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Has_A_Valid_Response){
        
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true);
        FakeConnection.ResultValidResponse = true;
-       FakeConnection.Connect();
+       FakeConnection.Connect(false);
        
        EXPECT_EQ(true, FakeConnection.HasValidResponse());
        
@@ -287,7 +324,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Has_A_Invalid_Response){
        
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true);
        FakeConnection.ResultValidResponse = false;
-       FakeConnection.Connect();
+       FakeConnection.Connect(false);
        
        EXPECT_EQ(false, FakeConnection.HasValidResponse());
        
@@ -301,7 +338,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Uses_A_Self_Signed_SSL_Cert
        
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true);
        FakeConnection.ResultSelfSigned = true;
-       FakeConnection.Connect();
+       FakeConnection.Connect(false);
        
        EXPECT_EQ(true, FakeConnection.IsSelfSigned());
        
@@ -315,7 +352,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Doesnt_Use_A_Self_Signed_SS
        
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true);
        FakeConnection.ResultSelfSigned = false;
-       FakeConnection.Connect();
+       FakeConnection.Connect(false);
        
        EXPECT_EQ(false, FakeConnection.IsSelfSigned());
        
@@ -329,7 +366,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Gets_The_Server_Prefix_Of_P
        
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true);
        FakeConnection.ResultServerPrefix = "/prefix/test/a";
-       FakeConnection.Connect();
+       FakeConnection.Connect(false);
        
        EXPECT_EQ("/prefix/test/a", FakeConnection.GetDefaultPrefix());
        
@@ -343,7 +380,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Gets_The_Server_Prefix_Of_P
        
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true);
        FakeConnection.ResultServerPrefix = "/prefix/test/b";
-       FakeConnection.Connect();
+       FakeConnection.Connect(false);
        
        EXPECT_EQ("/prefix/test/b", FakeConnection.GetDefaultPrefix());
        
@@ -357,7 +394,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Adds_A_Contact_Successfully
        
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true, "/prefix", "Account1");
        FakeConnection.ResultServerPrefix = "/prefix/test/b";
-       FakeConnection.Connect();
+       FakeConnection.Connect(false);
        
        std::string ContactFile =
        "BEGIN:VCARD\n"
@@ -391,7 +428,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Fails_To_Add_A_Contact_Due_
        
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true, "/prefix", "Account1");
        FakeConnection.ResultServerPrefix = "/prefix/test/b";
-       FakeConnection.Connect();
+       FakeConnection.Connect(false);
        
        std::string ContactFile =
        "BEGIN:VCARD\n"
@@ -425,7 +462,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Fails_To_Add_A_Contact_Due_
        
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true, "/prefix", "Account1");
        FakeConnection.ResultServerPrefix = "/prefix/test/b";
-       FakeConnection.Connect();
+       FakeConnection.Connect(false);
        
        std::string ContactFile =
        "BEGIN:VCARD\n"
@@ -459,7 +496,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Fails_To_Add_A_Contact_Due_
        
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true, "/prefix", "Account1");
        FakeConnection.ResultServerPrefix = "/prefix/test/b";
-       FakeConnection.Connect();
+       FakeConnection.Connect(false);
        
        std::string ContactFile =
        "BEGIN:VCARD\n"
@@ -493,7 +530,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Edits_A_Server_Contact){
        
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true, "/prefix", "Account1");
        FakeConnection.ResultServerPrefix = "/prefix/test/b";
-       FakeConnection.Connect();
+       FakeConnection.Connect(false);
        
        std::string ContactFile =
        "BEGIN:VCARD\n"
@@ -541,7 +578,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Fails_To_Edit_A_Server_Cont
        
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true, "/prefix", "Account1");
        FakeConnection.ResultServerPrefix = "/prefix/test/b";
-       FakeConnection.Connect();
+       FakeConnection.Connect(false);
        
        std::string ContactFile =
        "BEGIN:VCARD\n"
@@ -575,7 +612,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Fails_To_Edit_A_Server_Cont
        
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true, "/prefix", "Account1");
        FakeConnection.ResultServerPrefix = "/prefix/test/b";
-       FakeConnection.Connect();
+       FakeConnection.Connect(false);
        
        std::string ContactFile =
        "BEGIN:VCARD\n"
@@ -609,7 +646,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Fails_To_Edit_A_Server_Cont
        
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true, "/prefix", "Account1");
        FakeConnection.ResultServerPrefix = "/prefix/test/b";
-       FakeConnection.Connect();
+       FakeConnection.Connect(false);
        
        std::string ContactFile =
        "BEGIN:VCARD\n"
@@ -643,7 +680,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Deletes_A_Server_Contact){
        
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true, "/prefix", "Account1");
        FakeConnection.ResultServerPrefix = "/prefix/test/b";
-       FakeConnection.Connect();
+       FakeConnection.Connect(false);
        
        FakeConnection.TestRequestResult = COREQUEST_OK;
        FakeConnection.TestEntityTag = "";
@@ -651,7 +688,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Deletes_A_Server_Contact){
        FakeConnection.TestSessionCode = 0;
        FakeConnection.TestResultMessage = "";
        
-       COServerResponse DeleteContactResult = FakeConnection.DeleteContact("testfile.vcf", "a23124sfadfdvxc1646541bsdfaf");
+       COServerResponse DeleteContactResult = FakeConnection.DeleteContact("testfile.vcf");
        
        EXPECT_EQ(COREQUEST_OK, DeleteContactResult.RequestResult);
        EXPECT_EQ("", DeleteContactResult.EntityTag);
@@ -665,7 +702,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Deletes_A_Server_Contact){
        FakeConnection.TestSessionCode = 0;
        FakeConnection.TestResultMessage = "";
 
-       DeleteContactResult = FakeConnection.DeleteContact("testfile.vcf", "asf84sa484saf614as64asvada4s6fas");
+       DeleteContactResult = FakeConnection.DeleteContact("testfile.vcf");
 
        EXPECT_EQ(COREQUEST_OK, DeleteContactResult.RequestResult);
        EXPECT_EQ("", DeleteContactResult.EntityTag);
@@ -683,7 +720,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Fails_To_Delete_A_Server_Co
        
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true, "/prefix", "Account1");
        FakeConnection.ResultServerPrefix = "/prefix/test/b";
-       FakeConnection.Connect();
+       FakeConnection.Connect(false);
        
        FakeConnection.TestRequestResult = COREQUEST_ERROR_SERVER;
        FakeConnection.TestEntityTag = "";
@@ -691,7 +728,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Fails_To_Delete_A_Server_Co
        FakeConnection.TestSessionCode = 22;
        FakeConnection.TestResultMessage = "You do not have permission to delete this resource.";
        
-       COServerResponse DeleteContactResult = FakeConnection.DeleteContact("testfile.vcf", "a23124sfadfdvxc1646541bsdfaf");
+       COServerResponse DeleteContactResult = FakeConnection.DeleteContact("testfile.vcf");
        
        EXPECT_EQ(COREQUEST_ERROR_SERVER, DeleteContactResult.RequestResult);
        EXPECT_EQ("", DeleteContactResult.EntityTag);
@@ -709,7 +746,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Fails_To_Delete_A_Server_Co
        
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true, "/prefix", "Account1");
        FakeConnection.ResultServerPrefix = "/prefix/test/b";
-       FakeConnection.Connect();
+       FakeConnection.Connect(false);
        
        FakeConnection.TestRequestResult = COREQUEST_ERROR_SERVER;
        FakeConnection.TestEntityTag = "";
@@ -717,7 +754,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Fails_To_Delete_A_Server_Co
        FakeConnection.TestSessionCode = 22;
        FakeConnection.TestResultMessage = "The resource could not be found.";
        
-       COServerResponse DeleteContactResult = FakeConnection.DeleteContact("testfile.vcf", "a23124sfadfdvxc1646541bsdfaf");
+       COServerResponse DeleteContactResult = FakeConnection.DeleteContact("testfile.vcf");
        
        EXPECT_EQ(COREQUEST_ERROR_SERVER, DeleteContactResult.RequestResult);
        EXPECT_EQ("", DeleteContactResult.EntityTag);
@@ -735,7 +772,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Fails_To_Delete_A_Server_Co
        
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true, "/prefix", "Account1");
        FakeConnection.ResultServerPrefix = "/prefix/test/b";
-       FakeConnection.Connect();
+       FakeConnection.Connect(false);
        
        FakeConnection.TestRequestResult = COREQUEST_ERROR_NOTCONNECTED;
        FakeConnection.TestEntityTag = "";
@@ -743,7 +780,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Fails_To_Delete_A_Server_Co
        FakeConnection.TestSessionCode = 0;
        FakeConnection.TestResultMessage = "";
        
-       COServerResponse DeleteContactResult = FakeConnection.DeleteContact("testfile.vcf", "a23124sfadfdvxc1646541bsdfaf");
+       COServerResponse DeleteContactResult = FakeConnection.DeleteContact("testfile.vcf");
        
        EXPECT_EQ(COREQUEST_ERROR_NOTCONNECTED, DeleteContactResult.RequestResult);
        EXPECT_EQ("", DeleteContactResult.EntityTag);
@@ -761,7 +798,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Gets_Server_Entity_Tag_Valu
        
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true, "/prefix", "Account1");
        FakeConnection.ResultServerPrefix = "/prefix/test/b";
-       FakeConnection.Connect();
+       FakeConnection.Connect(false);
        
        FakeConnection.TestRequestResult = COREQUEST_OK;
        FakeConnection.TestEntityTag = "a23124sfadfdvxc1646541bsdfaf";
@@ -787,7 +824,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Fails_To_Get_Server_Entity_
        
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true, "/prefix", "Account1");
        FakeConnection.ResultServerPrefix = "/prefix/test/b";
-       FakeConnection.Connect();
+       FakeConnection.Connect(false);
        
        FakeConnection.TestRequestResult = COREQUEST_ERROR_SERVER;
        FakeConnection.TestEntityTag = "";
@@ -813,7 +850,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Fails_To_Get_Server_Entity_
        
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true, "/prefix", "Account1");
        FakeConnection.ResultServerPrefix = "/prefix/test/b";
-       FakeConnection.Connect();
+       FakeConnection.Connect(false);
        
        FakeConnection.TestRequestResult = COREQUEST_ERROR_SERVER;
        FakeConnection.TestEntityTag = "";
@@ -839,7 +876,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Fails_To_Get_Server_Entity_
        
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true, "/prefix", "Account1");
        FakeConnection.ResultServerPrefix = "/prefix/test/b";
-       FakeConnection.Connect();
+       FakeConnection.Connect(false);
        
        FakeConnection.TestRequestResult = COREQUEST_ERROR_NOTCONNECTED;
        FakeConnection.TestEntityTag = "";
@@ -865,7 +902,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Gets_Server_Contact_Data){
        
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true, "/prefix", "Account1");
        FakeConnection.ResultServerPrefix = "/prefix/test/b";
-       FakeConnection.Connect();
+       FakeConnection.Connect(false);
        
        std::string ContactFile =
        "BEGIN:VCARD\n"
@@ -899,7 +936,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Fails_To_Gets_Server_Contac
        
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true, "/prefix", "Account1");
        FakeConnection.ResultServerPrefix = "/prefix/test/b";
-       FakeConnection.Connect();
+       FakeConnection.Connect(false);
        
        FakeConnection.TestRequestResult = COREQUEST_OK;
        FakeConnection.TestEntityTag = "";
@@ -925,7 +962,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Fails_To_Gets_Server_Contac
        
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true, "/prefix", "Account1");
        FakeConnection.ResultServerPrefix = "/prefix/test/b";
-       FakeConnection.Connect();
+       FakeConnection.Connect(false);
        
        FakeConnection.TestRequestResult = COREQUEST_OK;
        FakeConnection.TestEntityTag = "";
@@ -951,7 +988,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Fails_To_Get_Server_Contact
        
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true, "/prefix", "Account1");
        FakeConnection.ResultServerPrefix = "/prefix/test/b";
-       FakeConnection.Connect();
+       FakeConnection.Connect(false);
        
        FakeConnection.TestRequestResult = COREQUEST_ERROR_NOTCONNECTED;
        FakeConnection.TestEntityTag = "";
@@ -977,7 +1014,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Gets_A_Full_Server_Contact_
        
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true, "/prefix", "Account1");
        FakeConnection.ResultServerPrefix = "/prefix/test/b";
-       FakeConnection.Connect();       
+       FakeConnection.Connect(false);  
        
        std::string ContactFile1 =
        "BEGIN:VCARD\n"
@@ -1057,7 +1094,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Gets_A_Partial_Server_Conta
        
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true, "/prefix", "Account1");
        FakeConnection.ResultServerPrefix = "/prefix/test/b";
-       FakeConnection.Connect();       
+       FakeConnection.Connect(false);  
        
        std::string ContactFile3 =
        "BEGIN:VCARD\n"
@@ -1107,7 +1144,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Fails_To_Get_A_Contact_List
        
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true, "/prefix", "Account1");
        FakeConnection.ResultServerPrefix = "/prefix/test/b";
-       FakeConnection.Connect();
+       FakeConnection.Connect(false);
        
        COContactList ContactListSetup;
        ContactListSetup.SyncToken = "";
@@ -1139,7 +1176,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Fails_To_Get_A_Contact_List
        
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true, "/prefix", "Account1");
        FakeConnection.ResultServerPrefix = "/prefix/test/b";
-       FakeConnection.Connect();
+       FakeConnection.Connect(false);
        
        COContactList ContactListSetup;
        ContactListSetup.SyncToken = "";
@@ -1171,7 +1208,7 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Fails_To_Get_A_Contact_List
        
        FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true, "/prefix", "Account1");
        FakeConnection.ResultServerPrefix = "/prefix/test/b";
-       FakeConnection.Connect();
+       FakeConnection.Connect(false);
        
        COContactList ContactListSetup;
        ContactListSetup.SyncToken = "";
@@ -1193,4 +1230,26 @@ TEST(CardDAV, Use_Fake_To_Simulate_A_Connection_That_Fails_To_Get_A_Contact_List
 
        EXPECT_EQ(0, ServerDataResult.ListData.size());
 
+}
+
+TEST(CardDAV, Use_Fake_To_Simulate_A_Wait_For_A_Completed_Task){
+       
+       std::string ServerAddress1 = "gibberish.invalid";
+       std::string ServerUser1 = "user";
+       std::string ServerPass1 = "pass";
+       
+       FakeConnectionObject FakeConnection(ServerAddress1, 8080, ServerUser1, ServerPass1, true, "/prefix", "Account1");
+       FakeConnection.ResultServerPrefix = "/prefix/test/b";
+       FakeConnection.Connect(false);
+       FakeConnection.ResultTaskCompleted = false;
+       
+       while (!FakeConnection.IsTaskCompleted()){
+               
+               std::this_thread::sleep_for(std::chrono::milliseconds(250));
+               FakeConnection.ResultTaskCompleted = true;
+               
+       }
+       
+       EXPECT_TRUE(FakeConnection.ResultTaskCompleted);
+       
 }
\ No newline at end of file
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy