summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndriy Byzhynar <AByzhynar@luxoft.com>2018-05-14 10:58:17 +0300
committerIra Lytvynenko (GitHub) <ILytvynenko@luxoft.com>2018-05-24 13:15:46 +0300
commit6d20a0e2f032ea21d1268d3b2acc67c4693a6f0f (patch)
treeb83bde612bea7cc9684cdc4ff836081ce6344a3c
parent0a0755108ecc30dfb3d5a063e25c2b365d136e65 (diff)
downloadsdl_core-6d20a0e2f032ea21d1268d3b2acc67c4693a6f0f.tar.gz
Fix unit tests according to changed logic
-rw-r--r--src/components/application_manager/test/commands/mobile/on_system_request_notification_test.cc20
-rw-r--r--src/components/include/test/policy/policy_external/policy/mock_cache_manager.h7
-rw-r--r--src/components/include/test/policy/policy_external/policy/mock_policy_manager.h7
-rw-r--r--src/components/policy/policy_external/test/sql_pt_representation_test.cc3
4 files changed, 28 insertions, 9 deletions
diff --git a/src/components/application_manager/test/commands/mobile/on_system_request_notification_test.cc b/src/components/application_manager/test/commands/mobile/on_system_request_notification_test.cc
index 231727397d..60af9381e8 100644
--- a/src/components/application_manager/test/commands/mobile/on_system_request_notification_test.cc
+++ b/src/components/application_manager/test/commands/mobile/on_system_request_notification_test.cc
@@ -85,11 +85,12 @@ class OnSystemRequestNotificationTest
};
TEST_F(OnSystemRequestNotificationTest, Run_ProprietaryType_SUCCESS) {
- const RequestType::eType kRequestType = RequestType::PROPRIETARY;
+ const mobile_apis::RequestType::eType request_type =
+ mobile_apis::RequestType::PROPRIETARY;
MessageSharedPtr msg = CreateMessage();
(*msg)[strings::params][strings::connection_key] = kConnectionKey;
- (*msg)[strings::msg_params][strings::request_type] = kRequestType;
+ (*msg)[strings::msg_params][strings::request_type] = request_type;
SharedPtr<OnSystemRequestNotification> command =
CreateCommand<OnSystemRequestNotification>(msg);
@@ -129,11 +130,12 @@ TEST_F(OnSystemRequestNotificationTest, Run_ProprietaryType_SUCCESS) {
}
TEST_F(OnSystemRequestNotificationTest, Run_HTTPType_SUCCESS) {
- const RequestType::eType kRequestType = RequestType::HTTP;
+ const mobile_apis::RequestType::eType request_type =
+ mobile_apis::RequestType::HTTP;
MessageSharedPtr msg = CreateMessage();
(*msg)[strings::params][strings::connection_key] = kConnectionKey;
- (*msg)[strings::msg_params][strings::request_type] = kRequestType;
+ (*msg)[strings::msg_params][strings::request_type] = request_type;
SharedPtr<OnSystemRequestNotification> command =
CreateCommand<OnSystemRequestNotification>(msg);
@@ -166,11 +168,12 @@ TEST_F(OnSystemRequestNotificationTest, Run_HTTPType_SUCCESS) {
}
TEST_F(OnSystemRequestNotificationTest, Run_InvalidApp_NoNotification) {
- const RequestType::eType kRequestType = RequestType::HTTP;
+ const mobile_apis::RequestType::eType request_type =
+ mobile_apis::RequestType::HTTP;
MessageSharedPtr msg = CreateMessage();
(*msg)[strings::params][strings::connection_key] = kConnectionKey;
- (*msg)[strings::msg_params][strings::request_type] = kRequestType;
+ (*msg)[strings::msg_params][strings::request_type] = request_type;
SharedPtr<OnSystemRequestNotification> command =
CreateCommand<OnSystemRequestNotification>(msg);
@@ -190,11 +193,12 @@ TEST_F(OnSystemRequestNotificationTest, Run_InvalidApp_NoNotification) {
}
TEST_F(OnSystemRequestNotificationTest, Run_RequestNotAllowed_NoNotification) {
- const RequestType::eType kRequestType = RequestType::HTTP;
+ const mobile_apis::RequestType::eType request_type =
+ mobile_apis::RequestType::HTTP;
MessageSharedPtr msg = CreateMessage();
(*msg)[strings::params][strings::connection_key] = kConnectionKey;
- (*msg)[strings::msg_params][strings::request_type] = kRequestType;
+ (*msg)[strings::msg_params][strings::request_type] = request_type;
SharedPtr<OnSystemRequestNotification> command =
CreateCommand<OnSystemRequestNotification>(msg);
diff --git a/src/components/include/test/policy/policy_external/policy/mock_cache_manager.h b/src/components/include/test/policy/policy_external/policy/mock_cache_manager.h
index 5aa92446b6..02931114f0 100644
--- a/src/components/include/test/policy/policy_external/policy/mock_cache_manager.h
+++ b/src/components/include/test/policy/policy_external/policy/mock_cache_manager.h
@@ -250,6 +250,13 @@ class MockCacheManagerInterface : public ::policy::CacheManagerInterface {
MOCK_METHOD2(OnDeviceSwitching,
void(const std::string& device_id_from,
const std::string& device_id_to));
+ MOCK_CONST_METHOD2(GetAppRequestSubTypes,
+ void(const std::string& policy_app_id,
+ std::vector<std::string>& request_subtypes));
+ MOCK_CONST_METHOD1(GetAppRequestTypesState,
+ RequestType::State(const std::string& policy_app_id));
+ MOCK_CONST_METHOD1(GetAppRequestSubTypesState,
+ RequestSubType::State(const std::string& policy_app_id));
};
} // namespace policy_test
diff --git a/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h b/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h
index 9e487da4ba..96e484acae 100644
--- a/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h
+++ b/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h
@@ -218,6 +218,13 @@ class MockPolicyManager : public PolicyManager {
MOCK_METHOD2(OnDeviceSwitching,
void(const std::string& device_id_from,
const std::string& device_id_to));
+ MOCK_CONST_METHOD1(
+ GetAppRequestSubTypes,
+ const std::vector<std::string>(const std::string& policy_app_id));
+ MOCK_CONST_METHOD1(GetAppRequestTypesState,
+ RequestType::State(const std::string& policy_app_id));
+ MOCK_CONST_METHOD1(GetAppRequestSubTypesState,
+ RequestSubType::State(const std::string& policy_app_id));
};
} // namespace policy_manager_test
} // namespace components
diff --git a/src/components/policy/policy_external/test/sql_pt_representation_test.cc b/src/components/policy/policy_external/test/sql_pt_representation_test.cc
index a657a01145..0b0831eaad 100644
--- a/src/components/policy/policy_external/test/sql_pt_representation_test.cc
+++ b/src/components/policy/policy_external/test/sql_pt_representation_test.cc
@@ -407,7 +407,8 @@ TEST_F(SQLPTRepresentationTest,
query.Prepare(query_select);
query.Next();
- const int policy_tables_number = 32;
+ // 33 - is current total tables number created by schema
+ const int policy_tables_number = 33;
ASSERT_EQ(policy_tables_number, query.GetInteger(0));
const std::string query_select_count_of_iap_buffer_full =