PamModuleArgValue: add unit test coverage

This commit refactorred the codes such that it becomes possible to unit
test the two non-trivial method: setPamModuleArgValue and
getPamModuleArgValue.

The unit test manipulates temporary files in the unit test container
instead of real pam configs.

Check the coverage data before and after this commit to see how these
two files now get nearly 100% unit test coverage.

Tested: unit test.

Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: Ibad461ace0eae89183de0ddbfb189ee0458b1d2e
diff --git a/user_mgr.hpp b/user_mgr.hpp
index 4a82950..ac163f7 100644
--- a/user_mgr.hpp
+++ b/user_mgr.hpp
@@ -193,6 +193,33 @@
      **/
     UserInfoMap getUserInfo(std::string userName) override;
 
+  protected:
+    /** @brief get pam argument value
+     *  method to get argument value from pam configuration
+     *
+     *  @param[in] moduleName - name of the module from where arg has to be read
+     *  @param[in] argName - argument name
+     *  @param[out] argValue - argument value
+     *
+     *  @return 0 - success state of the function
+     */
+    int getPamModuleArgValue(const std::string& moduleName,
+                             const std::string& argName, std::string& argValue);
+
+    /** @brief set pam argument value
+     *  method to set argument value in pam configuration
+     *
+     *  @param[in] moduleName - name of the module in which argument value has
+     * to be set
+     *  @param[in] argName - argument name
+     *  @param[out] argValue - argument value
+     *
+     *  @return 0 - success state of the function
+     */
+    int setPamModuleArgValue(const std::string& moduleName,
+                             const std::string& argName,
+                             const std::string& argValue);
+
   private:
     /** @brief sdbusplus handler */
     sdbusplus::bus_t& bus;
@@ -302,32 +329,6 @@
      */
     size_t getIpmiUsersCount(void);
 
-    /** @brief get pam argument value
-     *  method to get argument value from pam configuration
-     *
-     *  @param[in] moduleName - name of the module from where arg has to be read
-     *  @param[in] argName - argument name
-     *  @param[out] argValue - argument value
-     *
-     *  @return 0 - success state of the function
-     */
-    int getPamModuleArgValue(const std::string& moduleName,
-                             const std::string& argName, std::string& argValue);
-
-    /** @brief set pam argument value
-     *  method to set argument value in pam configuration
-     *
-     *  @param[in] moduleName - name of the module in which argument value has
-     * to be set
-     *  @param[in] argName - argument name
-     *  @param[out] argValue - argument value
-     *
-     *  @return 0 - success state of the function
-     */
-    int setPamModuleArgValue(const std::string& moduleName,
-                             const std::string& argName,
-                             const std::string& argValue);
-
     /** @brief get service name
      *  method to get dbus service name
      *
@@ -354,6 +355,9 @@
     virtual DbusUserObj getPrivilegeMapperObject(void);
 
     friend class TestUserMgr;
+
+    std::string pamPasswdConfigFile;
+    std::string pamAuthConfigFile;
 };
 
 } // namespace user