diff options
author | AKalinich-Luxoft <AKalinich@luxoft.com> | 2018-05-25 15:10:06 +0300 |
---|---|---|
committer | Andrii Kalinich <AKalinich@luxoft.com> | 2018-06-18 21:15:00 +0300 |
commit | 6c33fcaf72bf184b2daa22a9abde3ca36cea000b (patch) | |
tree | 19b9446c1f8b90e7e9ed8cf9f32e26563e218463 | |
parent | 8d2379ca0b62c97118293e24d9ae097f1a556c6a (diff) | |
download | sdl_core-6c33fcaf72bf184b2daa22a9abde3ca36cea000b.tar.gz |
Fixed affected mocks and UT's
Added new expectations for a security tests due to some
changes in the security flow
-rw-r--r-- | src/components/security_manager/test/crypto_manager_impl_test.cc | 31 |
1 files changed, 13 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 47e63dc194..5569325b96 100644 --- a/src/components/security_manager/test/crypto_manager_impl_test.cc +++ b/src/components/security_manager/test/crypto_manager_impl_test.cc @@ -145,26 +145,21 @@ 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()); + +>>>>>>> Fixed affected mocks and UT's EXPECT_CALL(*mock_security_manager_settings_, security_manager_protocol_name()) .WillOnce(Return(security_manager::TLSv1_2)); |