Implement unit test for getUserInfo function
in phosphor-user-manager
added testcases
1.unit test for ldap entry does not exist
2.unit test for local user.
3.unit test for ldap user with privilege mapper entry
4.unit test for ldap user without privilege mapper entry
gerrit link for getUserInfo function
https://gerrit.openbmc-project.xyz/#/c/openbmc/phosphor-user-manager/+/18132/
Change-Id: Idfd7e1ffeb8acfebab590c8c5fd6adc9bcf218dc
Signed-off-by: Ravi Teja <raviteja28031990@gmail.com>
diff --git a/user_mgr.hpp b/user_mgr.hpp
index c78174d..7409b73 100644
--- a/user_mgr.hpp
+++ b/user_mgr.hpp
@@ -153,7 +153,7 @@
* @param[in] - user name
* @return - true / false indicating user locked / un-locked
**/
- bool userLockedForFailedAttempt(const std::string &userName);
+ virtual bool userLockedForFailedAttempt(const std::string &userName);
/** @brief lists user locked state for failed attempt
*
@@ -318,20 +318,23 @@
*/
std::string getServiceName(std::string &&path, std::string &&intf);
+ protected:
/** @brief get LDAP group name
* method to get LDAP group name for the given LDAP user
*
* @param[in] - userName
* @return - group name
*/
- std::string getLdapGroupName(const std::string &userName);
+ virtual std::string getLdapGroupName(const std::string &userName);
/** @brief get privilege mapper object
* method to get dbus privilege mapper object
*
* @return - map of user object
*/
- DbusUserObj getPrivilegeMapperObject(void);
+ virtual DbusUserObj getPrivilegeMapperObject(void);
+
+ friend class TestUserMgr;
};
} // namespace user