From 6c33fcaf72bf184b2daa22a9abde3ca36cea000b Mon Sep 17 00:00:00 2001 From: AKalinich-Luxoft Date: Fri, 25 May 2018 15:10:06 +0300 Subject: Fixed affected mocks and UT's Added new expectations for a security tests due to some changes in the security flow --- .../test/crypto_manager_impl_test.cc | 31 +++++++++------------- 1 file 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(-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)); -- cgit v1.2.1