Revert "Unit Test: Adding unit test cases UsrMgr"
This reverts commit 0e427be810a3233f23186cce599e8bf680ae3f62.
Change-Id: I01478d33b2d9d413fab5d7e548e7312de4f07f6b
Signed-off-by: Ravi Teja <raviteja28031990@gmail.com>
diff --git a/test/mock_user_mgr.hpp b/test/mock_user_mgr.hpp
index b301ba7..99f2b37 100644
--- a/test/mock_user_mgr.hpp
+++ b/test/mock_user_mgr.hpp
@@ -25,15 +25,6 @@
friend class TestUserMgr;
};
-class MockUser : public Users
-{
- public:
- MockUser(sdbusplus::bus::bus& bus, const char* objPath,
- std::vector<std::string> groupNames, const std::string& priv,
- bool enabled, UserMgr& parent) :
- Users(bus, objPath, groupNames, priv, enabled, parent)
- {}
- MOCK_METHOD0(createSecretKey, std::string());
-};
+
} // namespace user
} // namespace phosphor
diff --git a/test/user_mgr_test.cpp b/test/user_mgr_test.cpp
index bb84e6d..9dd799a 100644
--- a/test/user_mgr_test.cpp
+++ b/test/user_mgr_test.cpp
@@ -55,9 +55,9 @@
.WillByDefault(testing::Return(false));
}
mockManager.usersList.emplace(
- userName,
- std::make_unique<MockUser>(mockManager.bus, userObj.c_str(),
- groupNames, priv, enabled, mockManager));
+ userName, std::make_unique<phosphor::user::Users>(
+ mockManager.bus, userObj.c_str(), groupNames, priv,
+ enabled, mockManager));
}
DbusUserObj createPrivilegeMapperDbusObject(void)
@@ -131,59 +131,6 @@
EXPECT_EQ(false, std::get<bool>(userInfo["UserPasswordExpired"]));
EXPECT_EQ(false, std::get<bool>(userInfo["RemoteUser"]));
}
-TEST_F(TestUserMgr, mfaEnabled)
-{
- auto ret =
- mockManager.enabled(MultiFactorAuthType::GoogleAuthenticator, false);
- EXPECT_EQ(ret, MultiFactorAuthType::GoogleAuthenticator);
- EXPECT_EQ(ret, mockManager.enabled());
-
- ret = mockManager.enabled(MultiFactorAuthType::None, false);
- EXPECT_EQ(ret, MultiFactorAuthType::None);
- EXPECT_EQ(ret, mockManager.enabled());
-}
-TEST_F(TestUserMgr, mfaDefaultUser)
-{
- std::string userName = "testUser";
- std::string privilege = "priv-admin";
- std::vector<std::string> groups{"testGroup"};
- // Create local user
- createLocalUser(userName, groups, privilege, true);
- auto user = mockManager.getUserObject(userName);
- EXPECT_EQ(user->secretKeyIsValid(), false);
-}
-TEST_F(TestUserMgr, mfaCreateSecretKeyEnableMFA)
-{
- std::string userName = "testUser";
- std::string privilege = "priv-admin";
- std::vector<std::string> groups{"testGroup"};
- // Create local user
- createLocalUser(userName, groups, privilege, true);
- MockUser* user =
- static_cast<MockUser*>(mockManager.getUserObject(userName));
- EXPECT_EQ(user->secretKeyIsValid(), false);
- auto ret =
- mockManager.enabled(MultiFactorAuthType::GoogleAuthenticator, true);
- EXPECT_EQ(ret, MultiFactorAuthType::GoogleAuthenticator);
- ON_CALL(*user, createSecretKey).WillByDefault(testing::Return("SKJDY&@H"));
- user->createSecretKey();
- EXPECT_EQ(user->secretKeyIsValid(), false);
-}
-TEST_F(TestUserMgr, bypassMFA)
-{
- std::string userName = "testUser";
- std::string privilege = "priv-admin";
- std::vector<std::string> groups{"testGroup"};
- // Create local user
- createLocalUser(userName, groups, privilege, true);
- MockUser* user =
- static_cast<MockUser*>(mockManager.getUserObject(userName));
- mockManager.enabled(MultiFactorAuthType::GoogleAuthenticator, true);
- user->bypassedProtocol(MultiFactorAuthType::GoogleAuthenticator, false);
- EXPECT_EQ(user->secretKeyGenerationRequired(), false);
- user->bypassedProtocol(MultiFactorAuthType::None, false);
- EXPECT_EQ(user->secretKeyGenerationRequired(), true);
-}
TEST_F(TestUserMgr, ldapUserWithPrivMapper)
{
diff --git a/user_mgr.hpp b/user_mgr.hpp
index 752d72e..b69cb87 100644
--- a/user_mgr.hpp
+++ b/user_mgr.hpp
@@ -271,12 +271,6 @@
void createGroup(std::string groupName) override;
void deleteGroup(std::string groupName) override;
-
- phosphor::user::Users* getUserObject(const std::string& userName)
- {
- return usersList[userName].get();
- }
-
MultiFactorAuthType enabled() const override
{
return MultiFactorAuthConfigurationIface::enabled();