name constraint check: add unit tests
This commit adds unit test for |ThrowForUserNameConstraints|. All lines
are covered by test now.
Tested: unit test passed
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: If1a0ff823ca0767f068030f205efdc1eb33e3029
diff --git a/user_mgr.hpp b/user_mgr.hpp
index dd73fff..d298bf0 100644
--- a/user_mgr.hpp
+++ b/user_mgr.hpp
@@ -246,6 +246,16 @@
*/
void throwForUserExists(const std::string& userName);
+ /** @brief check user name constraints
+ * method to check user name constraints and throw if failed.
+ *
+ * @param[in] userName - name of the user
+ * @param[in] groupNames - user groups
+ */
+ void
+ throwForUserNameConstraints(const std::string& userName,
+ const std::vector<std::string>& groupNames);
+
private:
/** @brief sdbusplus handler */
sdbusplus::bus_t& bus;
@@ -281,16 +291,6 @@
*/
UserSSHLists getUserAndSshGrpList(void);
- /** @brief check user name constraints
- * method to check user name constraints and throw if failed.
- *
- * @param[in] userName - name of the user
- * @param[in] groupNames - user groups
- */
- void
- throwForUserNameConstraints(const std::string& userName,
- const std::vector<std::string>& groupNames);
-
/** @brief check group user count
* method to check max group user count, and throw if limit reached
*