add osdGetRoles()
This commit is contained in:
+26
-1
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user