diff options
author | AKalinich-Luxoft <AKalinich@luxoft.com> | 2018-05-25 15:10:06 +0300 |
---|---|---|
committer | AKalinich-Luxoft <AKalinich@luxoft.com> | 2018-06-15 17:09:14 +0300 |
commit | 981c151648e0fd18639e46693e66bef357a7df8b (patch) | |
tree | bd35ef882a7820d36b3502d496568d9653796937 | |
parent | 671c6b5966ee58343ce87f31f35e9d3df1fe269c (diff) | |
download | sdl_core-981c151648e0fd18639e46693e66bef357a7df8b.tar.gz |
Fixed affected mocks and UT's
Added new expectations for a security tests due to some
changes in the security flow
Conflicts:
src/components/security_manager/test/crypto_manager_impl_test.cc
-rw-r--r-- | src/components/security_manager/test/crypto_manager_impl_test.cc | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/src/components/security_manager/test/crypto_manager_impl_test.cc b/src/components/security_manager/test/crypto_manager_impl_test.cc index 90c61715db..c05969d801 100644 --- a/src/components/security_manager/test/crypto_manager_impl_test.cc +++ b/src/components/security_manager/test/crypto_manager_impl_test.cc @@ -144,26 +144,20 @@ TEST_F(CryptoManagerTest, UsingBeforeInit) { } TEST_F(CryptoManagerTest, WrongInit) { - forced_protected_services_.push_back(kServiceNumber); - forced_unprotected_services_.push_back(kServiceNumber); - EXPECT_CALL(*mock_security_manager_settings_, security_manager_mode()) - .WillOnce(Return(security_manager::SERVER)); - EXPECT_CALL(*mock_security_manager_settings_, force_unprotected_service()) - .WillOnce(ReturnRef(forced_unprotected_services_)); - EXPECT_CALL(*mock_security_manager_settings_, force_protected_service()) - .WillOnce(ReturnRef(forced_protected_services_)); - EXPECT_FALSE(crypto_manager_->Init()); - forced_protected_services_.pop_back(); - forced_unprotected_services_.pop_back(); - EXPECT_NE(std::string(), crypto_manager_->LastError()); + // We have to cast (-1) to security_manager::Protocol Enum to be accepted by + // crypto_manager_->Init(...) + // Unknown protocol version + security_manager::Protocol UNKNOWN = + static_cast<security_manager::Protocol>(-1); // Unexistent cipher value const std::string invalid_cipher = "INVALID_UNKNOWN_CIPHER"; - EXPECT_CALL(*mock_security_manager_settings_, security_manager_mode()) - .WillOnce(Return(security_manager::SERVER)); - EXPECT_CALL(*mock_security_manager_settings_, force_unprotected_service()) - .WillOnce(ReturnRef(forced_unprotected_services_)); - EXPECT_CALL(*mock_security_manager_settings_, force_protected_service()) - .WillOnce(ReturnRef(forced_protected_services_)); + const security_manager::Mode mode = security_manager::SERVER; + + SetInitialValues(mode, UNKNOWN, invalid_cipher); + + EXPECT_FALSE(crypto_manager_->Init()); + EXPECT_NE(std::string(), crypto_manager_->LastError()); + EXPECT_CALL(*mock_security_manager_settings_, security_manager_protocol_name()) .WillOnce(Return(security_manager::TLSv1_2)); |