use of jetbrains.buildServer.server.rest.model.server.LicensingData in project teamcity-rest by JetBrains.
the class ServerRequestTest method test_default_fields_in_licensing_data.
@Test
public void test_default_fields_in_licensing_data() throws Throwable {
final SUser user = createUser("user");
user.addRole(RoleScope.globalScope(), getSysAdminRole());
LicensingData data = myRequest.getLicensingData("");
assertNotNull(data.maxAgents);
assertNotNull(data.getAgentsLeft());
assertNotNull(data.serverLicenseType);
assertNotNull(data.serverEffectiveReleaseDate);
assertNotNull(data.licenseKeys);
}
use of jetbrains.buildServer.server.rest.model.server.LicensingData in project teamcity-rest by JetBrains.
the class ServerRequestTest method test_user_needs_view_agent_details_permission_to_access_avaliable_agents.
@Test(description = "TW-68673")
public void test_user_needs_view_agent_details_permission_to_access_avaliable_agents() throws Throwable {
MockAuthorityHolder mockUser = new MockAuthorityHolder();
mockUser.globalPerms = new Permissions(Permission.VIEW_AGENT_DETAILS);
myFixture.getSecurityContext().runAs(mockUser, () -> {
LicensingData data = myRequest.getLicensingData("maxAgents,serverLicenseType,agentsLeft");
assertNull(data.maxAgents);
assertNull(data.serverLicenseType);
assertNotNull(data.getAgentsLeft());
});
}
use of jetbrains.buildServer.server.rest.model.server.LicensingData in project teamcity-rest by JetBrains.
the class ServerRequestTest method test_user_with_enough_permissions_should_get_licensing_data.
@Test
public void test_user_with_enough_permissions_should_get_licensing_data() throws Throwable {
final SUser user = createUser("user");
user.addRole(RoleScope.globalScope(), getSysAdminRole());
LicensingData data = myRequest.getLicensingData("licenseUseExceeded,maxAgents,unlimitedAgents,agentsLeft,maxBuildTypes,unlimitedBuildTypes,buildTypesLeft,serverLicenseType");
assertNotNull(data.licenseUseExceeded);
assertNotNull(data.maxAgents);
assertNotNull(data.unlimitedAgents);
assertNotNull(data.getAgentsLeft());
}
use of jetbrains.buildServer.server.rest.model.server.LicensingData in project teamcity-rest by JetBrains.
the class ServerRequestTest method test_user_needs_manage_server_licenses_permission_to_access_licensing_data.
@Test
public void test_user_needs_manage_server_licenses_permission_to_access_licensing_data() throws Throwable {
MockAuthorityHolder mockUser = new MockAuthorityHolder();
myFixture.getSecurityContext().runAs(mockUser, () -> {
LicensingData data = myRequest.getLicensingData("maxAgents,serverLicenseType,agentsLeft");
assertNull(data.maxAgents);
assertNull(data.serverLicenseType);
assertNull(data.getAgentsLeft());
});
mockUser.globalPerms = new Permissions(Permission.MANAGE_SERVER_LICENSES);
myFixture.getSecurityContext().runAs(mockUser, () -> {
LicensingData data = myRequest.getLicensingData("maxAgents,serverLicenseType,agentsLeft");
assertNotNull(data.maxAgents);
assertNotNull(data.serverLicenseType);
assertNotNull(data.getAgentsLeft());
});
}
Aggregations