Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
CardDAV2: Fixed FakeConnectionObject unit tests
[xestiaab/.git] / source / tests / classes / FakeConnectionObject.cpp
1 // FakeConnectionObject.cpp - FakeConnectionObject class
2 //
3 // (c) 2012-2015 Xestia Software Development.
4 //
5 // This file is part of Xestia Address Book.
6 //
7 // Xestia Address Book is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
10 //
11 // Xestia Address Book is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>
19 #include "FakeConnectionObject.h"
21 FakeConnectionObject::FakeConnectionObject(std::string ServerAddress, int ServerPort, 
22         std::string ServerUser, std::string ServerPass, bool ServerSSL){
23         
24         this->ServerAddress = ServerAddress;
25         this->ServerPort = ServerPort;
26         this->ServerUser = ServerUser;
27         this->ServerPass = ServerPass;
28         this->ServerSSL = ServerSSL;
29                 
30 }
32 FakeConnectionObject::FakeConnectionObject(std::string ServerAddress, int ServerPort, 
33         std::string ServerUser, std::string ServerPass, bool ServerSSL, 
34         std::string ServerPrefix, std::string ServerAccount){
35         
36         this->ServerAddress = ServerAddress;
37         this->ServerPort = ServerPort;
38         this->ServerUser = ServerUser;
39         this->ServerPass = ServerPass;
40         this->ServerSSL = ServerSSL;
41         this->ServerPrefix = ServerPrefix;
42         this->ServerAccount = ServerAccount;
43                 
44 }
46 FakeConnectionObject::~FakeConnectionObject(){
47         
48 }
50 COConnectResult FakeConnectionObject::Connect(bool DoAuthentication){
51         
52         COConnectResult ConnectResult = ResultStatus;
53         AuthPassed = ResultAuthPassed;
54         CanProcess = ResultCanProcess;
55         SSLStatus = ResultSSLStatus;
56         SSLVerified = ResultSSLVerified;
57         ValidResponse = ResultValidResponse;
58         SSLSelfSigned = ResultSelfSigned;
59         ServerPrefix = ResultServerPrefix;
60         return ConnectResult;
61         
62 }
64 bool FakeConnectionObject::IsTaskCompleted(){
65         TaskCompleted = ResultTaskCompleted;
66         return TaskCompleted;
67 }
69 std::string FakeConnectionObject::GetDefaultPrefix(){
70         return ServerPrefix;
71 }
73 COServerResponse FakeConnectionObject::AddContact(std::string Location, std::string Data){
74         
75         COServerResponse AddContactResult;
76         
77         AddContactResult.RequestResult = TestRequestResult;
78         AddContactResult.EntityTag = TestEntityTag;
79         AddContactResult.SessionCode = TestSessionCode;
80         AddContactResult.ResultCode = TestResultCode;
81         AddContactResult.ResultMessage = TestResultMessage;
82         
83         return AddContactResult;
84         
85 }
87 COServerResponse FakeConnectionObject::EditContact(std::string Location, std::string Data){
88         
89         COServerResponse EditContactResult;
90         
91         EditContactResult.RequestResult = TestRequestResult;
92         EditContactResult.EntityTag = TestEntityTag;
93         EditContactResult.SessionCode = TestSessionCode;
94         EditContactResult.ResultCode = TestResultCode;
95         EditContactResult.ResultMessage = TestResultMessage;
96         
97         return EditContactResult;       
98         
99 }
101 COServerResponse FakeConnectionObject::DeleteContact(std::string Location){
102         
103         COServerResponse DeleteContactResult;
104         
105         DeleteContactResult.RequestResult = TestRequestResult;
106         DeleteContactResult.EntityTag = TestEntityTag;
107         DeleteContactResult.SessionCode = TestSessionCode;
108         DeleteContactResult.ResultCode = TestResultCode;
109         DeleteContactResult.ResultMessage = TestResultMessage;
110         
111         return DeleteContactResult;     
112         
115 COServerResponse FakeConnectionObject::GetServerEntityTagValue(std::string Location){
116         
117         COServerResponse EntityTagResult;
119         EntityTagResult.RequestResult = TestRequestResult;
120         EntityTagResult.EntityTag = TestEntityTag;
121         EntityTagResult.SessionCode = TestSessionCode;
122         EntityTagResult.ResultCode = TestResultCode;
123         EntityTagResult.ResultMessage = TestResultMessage;
124         
125         return EntityTagResult;
126         
129 COServerResponse FakeConnectionObject::GetContact(std::string Location){
130         
131         COServerResponse GetContactResult;
133         GetContactResult.RequestResult = TestRequestResult;
134         GetContactResult.EntityTag = TestEntityTag;
135         GetContactResult.SessionCode = TestSessionCode;
136         GetContactResult.ResultCode = TestResultCode;
137         GetContactResult.ResultMessage = TestResultMessage;
138         
139         return GetContactResult;        
140         
143 COContactList FakeConnectionObject::GetContactList(std::string SyncToken){
144         
145         COContactList GetContactListResult = TestContactList;
147         GetContactListResult.ServerResponse.RequestResult = TestRequestResult;
148         GetContactListResult.ServerResponse.EntityTag = TestEntityTag;
149         GetContactListResult.ServerResponse.SessionCode = TestSessionCode;
150         GetContactListResult.ServerResponse.ResultCode = TestResultCode;
151         GetContactListResult.ServerResponse.ResultMessage = TestResultMessage;
152         
153         return GetContactListResult;
154         
157 std::string FakeConnectionObject::GetServerAddress(){
158         return ServerAddress;
161 unsigned int FakeConnectionObject::GetServerPort(){
162         return ServerPort;
165 std::string FakeConnectionObject::GetServerUser(){
166         return ServerUser;      
169 std::string FakeConnectionObject::GetServerPass(){
170         return ServerPass;
173 std::string FakeConnectionObject::GetServerPrefix(){
174         return ServerPrefix;
177 std::string FakeConnectionObject::GetServerAccount(){
178         return ServerAccount;
181 bool FakeConnectionObject::GetServerSSL(){
182         return ServerSSL;
185 bool FakeConnectionObject::GetTestMode(){
186         return ResultTestMode;
189 bool FakeConnectionObject::CanDoProcessing(){
190         return CanProcess;
193 bool FakeConnectionObject::CanDoSSL(){
194         return SSLStatus;       
197 COSSLVerified FakeConnectionObject::SSLVerify(){
198         return SSLVerified;
201 bool FakeConnectionObject::AbleToLogin(){
202         return AuthPassed;
205 bool FakeConnectionObject::HasValidResponse(){
206         return ValidResponse;
209 bool FakeConnectionObject::IsSelfSigned(){
210         return SSLSelfSigned;
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