ListProjectsIT: Add test for parent candidates option

Change-Id: If858a007d43b10a03b180f20fd5756a37fb52649
This commit is contained in:
David Pursehouse 2019-01-22 12:09:46 +09:00
parent 9631c9a9f3
commit 099f7592de
1 changed files with 21 additions and 0 deletions

View File

@ -195,6 +195,27 @@ public class ListProjectsIT extends AbstractDaemonTest {
.inOrder();
}
@Test
public void listParentCandidates() throws Exception {
Map<String, ProjectInfo> result =
gApi.projects().list().withType(FilterType.PARENT_CANDIDATES).getAsMap();
assertThat(result).hasSize(1);
assertThat(result).containsKey(allProjects.get());
// Create a new project with 'project' as parent
Project.NameKey testProject = createProject(name("test"), project);
// Parent candidates are All-Projects and 'project'
assertThatNameList(filter(gApi.projects().list().withType(FilterType.PARENT_CANDIDATES).get()))
.containsExactly(allProjects, project)
.inOrder();
// All projects are listed
assertThatNameList(filter(gApi.projects().list().get()))
.containsExactly(allProjects, allUsers, testProject, project)
.inOrder();
}
@Test
public void listWithHiddenProject() throws Exception {
Project.NameKey hidden = createProject("project-to-hide");