userEnable: fix bug and add unit test
This commit adds unit tests for the |userEnable| function. To make it
happen, a new overload of |executeUserModify| is introduced. The idea
is the same as previous commits where we add sudo in unit tests.
Thanks to this unit test, this commit fixes an existing bug where the
corresponding user's |userEnabled| attribute isn't updated.
Tested: unit test passed
Coverage:
lines......: 81.3% (1918 of 2359 lines)
functions..: 93.9% (400 of 426 functions)
branches...: 32.0% (3029 of 9469 branches)
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: I89752e5fcfc1aabb4090b0b2e8faf5f1b5ee5e76
diff --git a/user_mgr.hpp b/user_mgr.hpp
index 53097a8..3f0d59c 100644
--- a/user_mgr.hpp
+++ b/user_mgr.hpp
@@ -320,6 +320,9 @@
virtual void executeUserModify(const char* userName, const char* newGroups,
bool sshRequested);
+ virtual void executeUserModifyUserEnable(const char* userName,
+ bool enabled);
+
/** @brief check for valid privielge
* method to check valid privilege, and throw if invalid
*