Skip to content

Commit 89d8216

Browse files
Fix a crash in ApiTests
Fix occurred due to missing cache. Resolves: OLPEDGE-1153 Signed-off-by: Mykhailo Kuchma <[email protected]>
1 parent 951ca3e commit 89d8216

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

olp-cpp-sdk-authentication/include/olp/authentication/ErrorResponse.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ struct AUTHENTICATION_API ErrorResponse {
4444
* request.
4545
*/
4646
std::string message;
47+
48+
/**
49+
* @brief Here Account error id returned as a result of an authentication
50+
* request.
51+
*/
52+
std::string error_id;
4753
};
4854

4955
/**

olp-cpp-sdk-authentication/src/BaseResult.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ namespace authentication {
3131
static const char* FIELD_NAME = "name";
3232
static const char* ERROR_CODE = "errorCode";
3333
static const char* ERROR_FIELDS = "errorFields";
34+
static const char* ERROR_ID = "errorId";
3435
static const char* ERROR_MESSAGE = "message";
3536
static const char* LINE_END = ".";
3637

@@ -48,6 +49,10 @@ BaseResult::BaseResult(int status, std::string error,
4849
return;
4950
}
5051

52+
if (json_document->HasMember(ERROR_ID)) {
53+
error_.error_id = (*json_document)[ERROR_ID].GetString();
54+
}
55+
5156
// Enhance error message with network response error details
5257
error_.code = (*json_document)[ERROR_CODE].GetUint();
5358

tests/functional/olp-cpp-sdk-authentication/AuthenticationClientTest.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,11 @@ class AuthenticationClientTest : public AuthenticationCommonTestFixture {
173173

174174
return request_future.get();
175175
}
176+
177+
std::string GetErrorId(
178+
const AuthenticationClient::SignInUserResponse& response) const {
179+
return response.GetResult().GetErrorResponse().error_id;
180+
}
176181
};
177182

178183
TEST_F(AuthenticationClientTest, SignInClient) {
@@ -332,11 +337,14 @@ TEST_F(AuthenticationClientTest, SignUpInUser) {
332337

333338
AuthenticationClient::SignInUserResponse response5 = SignInUser(email);
334339
EXPECT_EQ(olp::http::HttpStatusCode::UNAUTHORIZED,
335-
response5.GetResult().GetStatus());
340+
response5.GetResult().GetStatus())
341+
<< GetErrorId(response5);
336342
EXPECT_EQ(kErrorAccountNotFoundCode,
337-
response5.GetResult().GetErrorResponse().code);
343+
response5.GetResult().GetErrorResponse().code)
344+
<< GetErrorId(response5);
338345
EXPECT_EQ(kErrorAccountNotFoundMessage,
339-
response5.GetResult().GetErrorResponse().message);
346+
response5.GetResult().GetErrorResponse().message)
347+
<< GetErrorId(response5);
340348
}
341349

342350
TEST_F(AuthenticationClientTest, SignUpUserCancel) {

0 commit comments

Comments
 (0)