add osdGetRoles()

This commit is contained in:
Michael Davidsaver
2020-12-26 13:14:07 -08:00
parent 904dff1c37
commit dbed32309e
4 changed files with 225 additions and 1 deletions
+26 -1
View File
@@ -8,20 +8,45 @@
#include <epicsUnitTest.h>
#include <testMain.h>
#include <osiProcess.h>
#include <epicsThread.h>
#include <pvxs/unittest.h>
#include <pvxs/util.h>
#include <utilpvt.h>
namespace {
using namespace pvxs;
void testAccount()
{
testShow()<<__func__;
std::string account;
{
std::vector<char> buf(128);
testOk(osiGetUserName(buf.data(), buf.size()-1u)==osiGetUserNameSuccess, "osiGetUserName()");
buf.back() = '\0';
account = buf.data();
}
testOk(!account.empty(), "User: '%s'", account.c_str());
std::set<std::string> roles;
osdGetRoles(account, roles);
testNotEq(roles.size(), 0u);
for(auto& role : roles) {
testDiag(" %s", role.c_str());
}
}
} // namespace
MAIN(testutil)
{
testPlan(0);
testPlan(3);
testAccount();
return testDone();
}