use of com.google.gerrit.extensions.api.config.AccessCheckInfo in project gerrit by GerritCodeReview.
the class CheckAccessIT method noRules.
@Test
@Sandboxed
public void noRules() throws Exception {
normalProject = projectOperations.newProject().create();
for (AccessSection section : projectOperations.project(allProjectsName).getProjectConfig().getAccessSections()) {
if (!section.getName().startsWith(Constants.R_REFS)) {
continue;
}
for (Permission permission : section.getPermissions()) {
projectOperations.project(allProjectsName).forUpdate().remove(permissionKey(permission.getName()).ref(section.getName()).build()).update();
}
}
AccessCheckInput input = new AccessCheckInput();
input.account = privilegedUser.email();
input.permission = Permission.READ;
input.ref = "refs/heads/main";
AccessCheckInfo info = gApi.projects().name(normalProject.get()).checkAccess(input);
assertThat(info.status).isEqualTo(403);
assertThat(info.debugLogs).isNotEmpty();
assertThat(info.debugLogs.get(0)).contains("Found no rules");
}
Aggregations