use of com.google.gerrit.extensions.api.access.ProjectAccessInfo in project gerrit by GerritCodeReview.
the class AccessIT method listAccessWithoutSpecifyingAnEmptyProjectName.
@Test
public void listAccessWithoutSpecifyingAnEmptyProjectName() throws Exception {
RestResponse r = adminRestSession.get("/access/?p=");
r.assertOK();
Map<String, ProjectAccessInfo> infoByProject = newGson().fromJson(r.getReader(), new TypeToken<Map<String, ProjectAccessInfo>>() {
}.getType());
assertThat(infoByProject).isEmpty();
}
use of com.google.gerrit.extensions.api.access.ProjectAccessInfo in project gerrit by GerritCodeReview.
the class AccessIT method listAccess.
@Test
public void listAccess() throws Exception {
RestResponse r = adminRestSession.get("/access/?project=" + project.get());
r.assertOK();
Map<String, ProjectAccessInfo> infoByProject = newGson().fromJson(r.getReader(), new TypeToken<Map<String, ProjectAccessInfo>>() {
}.getType());
assertThat(infoByProject.keySet()).containsExactly(project.get());
}
use of com.google.gerrit.extensions.api.access.ProjectAccessInfo in project gerrit by GerritCodeReview.
the class PluginAccessIT method setAccessAddPluginProjectPermissionSucceed.
@Test
public void setAccessAddPluginProjectPermissionSucceed() throws Exception {
String pluginProjectPermission = "plugin-" + TEST_PLUGIN_NAME + "-" + TEST_PLUGIN_PROJECT_PERMISSION;
String accessSection = "refs/heads/plugin-permission";
ProjectAccessInput accessInput = createAccessInput(accessSection, pluginProjectPermission);
ProjectAccessInfo projectAccessInfo = gApi.projects().name(allProjects.get()).access(accessInput);
Set<String> permissions = projectAccessInfo.local.get(accessSection).permissions.keySet();
assertThat(permissions).contains(pluginProjectPermission);
// Verifies the plugin defined capability could be listed.
assertThat(pluginPermissionsUtil.collectPluginProjectPermissions()).containsKey(pluginProjectPermission);
}
Aggregations