userLockedForFailedAttempt: add unit test

This commit adds unit test for the |userLockedForFailedAttempt|
function. In order to do so, this commits adds a new virtual function
which reads the failed attempt. The function is overridden in unit test.

Tested: unit test passed.

Coverage:
  lines......: 83.1% (2007 of 2415 lines)
  functions..: 94.1% (430 of 457 functions)
  branches...: 32.3% (3181 of 9855 branches)

Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: I940ec42936c8b1c387fc0f19db13bc90a61c9852
diff --git a/user_mgr.cpp b/user_mgr.cpp
index f7d5e8e..adfa6ab 100644
--- a/user_mgr.cpp
+++ b/user_mgr.cpp
@@ -656,7 +656,7 @@
     std::vector<std::string> output;
     try
     {
-        output = executeCmd("/usr/sbin/pam_tally2", "-u", userName.c_str());
+        output = getFailedAttempt(userName.c_str());
     }
     catch (const InternalFailure& e)
     {
@@ -1352,5 +1352,10 @@
                (enabled ? "" : "1970-01-01"));
 }
 
+std::vector<std::string> UserMgr::getFailedAttempt(const char* userName)
+{
+    return executeCmd("/usr/sbin/pam_tally2", "-u", userName);
+}
+
 } // namespace user
 } // namespace phosphor