use of org.jvnet.hudson.test.MockAuthorizationStrategy in project configuration-as-code-plugin by jenkinsci.
the class PermissionsTest method checkPermissionsForManager.
@Test
public void checkPermissionsForManager() throws Exception {
final String MANAGER = "manager";
j.jenkins.setSecurityRealm(j.createDummySecurityRealm());
j.jenkins.setAuthorizationStrategy(new MockAuthorizationStrategy().grant(Jenkins.READ).everywhere().to(MANAGER).grant(Jenkins.MANAGE).everywhere().to(MANAGER));
JenkinsRule.WebClient webClient = j.createWebClient().withThrowExceptionOnFailingStatusCode(false);
assertUserPermissions(webClient, MANAGER, ImmutableMap.<Action, Boolean>builder().put(RELOAD_EXISTING_CONFIGURATION, true).build());
}
use of org.jvnet.hudson.test.MockAuthorizationStrategy in project configuration-as-code-plugin by jenkinsci.
the class PermissionsTest method checkPermissionsForAdmin.
@Test
public void checkPermissionsForAdmin() throws Exception {
final String ADMIN = "admin";
j.jenkins.setSecurityRealm(j.createDummySecurityRealm());
j.jenkins.setAuthorizationStrategy(new MockAuthorizationStrategy().grant(Jenkins.ADMINISTER).everywhere().to(ADMIN));
JenkinsRule.WebClient webClient = j.createWebClient().withThrowExceptionOnFailingStatusCode(false);
assertUserPermissions(webClient, ADMIN, ImmutableMap.<Action, Boolean>builder().put(VIEW_CONFIGURATION, true).put(DOWNLOAD_CONFIGURATION, true).put(APPLY_NEW_CONFIGURATION, true).put(RELOAD_EXISTING_CONFIGURATION, true).build());
}
Aggregations