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/test/mock_user_mgr.hpp b/test/mock_user_mgr.hpp
new file mode 100644
index 0000000..81f9065
--- /dev/null
+++ b/test/mock_user_mgr.hpp
@@ -0,0 +1,27 @@
+#include "user_mgr.hpp"
+#include <gmock/gmock.h>
+
+namespace phosphor
+{
+namespace user
+{
+
+constexpr auto objpath = "/dummy/user";
+
+class MockManager : public UserMgr
+{
+ public:
+ MockManager(sdbusplus::bus::bus& bus, const char* path) :
+ UserMgr(bus, objpath)
+ {
+ }
+
+ MOCK_METHOD1(getLdapGroupName, std::string(const std::string& userName));
+ MOCK_METHOD0(getPrivilegeMapperObject, DbusUserObj());
+ MOCK_METHOD1(userLockedForFailedAttempt, bool(const std::string& userName));
+
+ friend class TestUserMgr;
+};
+
+} // namespace user
+} // namespace phosphor