ThrowForInvalidPrivilege: add unit test

This commit adds unit test for the |throwForInvalidPrivilege| function.

Tested: unit test passed

Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: I0722ce2483adeffd493528c9c952aea9af181de6
diff --git a/test/user_mgr_test.cpp b/test/user_mgr_test.cpp
index 16d6617..f44282e 100644
--- a/test/user_mgr_test.cpp
+++ b/test/user_mgr_test.cpp
@@ -422,5 +422,20 @@
     EXPECT_NO_THROW(UserMgr::deleteUser(username));
 }
 
+TEST_F(UserMgrInTest, ThrowForInvalidPrivilegeThrowsWhenPrivilegeIsInvalid)
+{
+    EXPECT_THROW(
+        throwForInvalidPrivilege("whatever"),
+        sdbusplus::xyz::openbmc_project::Common::Error::InvalidArgument);
+}
+
+TEST_F(UserMgrInTest, ThrowForInvalidPrivilegeNoThrowWhenPrivilegeIsValid)
+{
+    EXPECT_NO_THROW(throwForInvalidPrivilege("priv-admin"));
+    EXPECT_NO_THROW(throwForInvalidPrivilege("priv-operator"));
+    EXPECT_NO_THROW(throwForInvalidPrivilege("priv-user"));
+    EXPECT_NO_THROW(throwForInvalidPrivilege("priv-noaccess"));
+}
+
 } // namespace user
 } // namespace phosphor