Merge "TestProjectCreation: Add permissionsOnly setting" into stable-3.2
This commit is contained in:
@@ -91,6 +91,7 @@ public class ProjectOperationsImpl implements ProjectOperations {
|
|||||||
|
|
||||||
CreateProjectArgs args = new CreateProjectArgs();
|
CreateProjectArgs args = new CreateProjectArgs();
|
||||||
args.setProjectName(name);
|
args.setProjectName(name);
|
||||||
|
args.permissionsOnly = projectCreation.permissionOnly().orElse(false);
|
||||||
args.branch = Collections.singletonList(Constants.R_HEADS + Constants.MASTER);
|
args.branch = Collections.singletonList(Constants.R_HEADS + Constants.MASTER);
|
||||||
args.createEmptyCommit = projectCreation.createEmptyCommit().orElse(true);
|
args.createEmptyCommit = projectCreation.createEmptyCommit().orElse(true);
|
||||||
projectCreation.parent().ifPresent(p -> args.newParent = p);
|
projectCreation.parent().ifPresent(p -> args.newParent = p);
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ public abstract class TestProjectCreation {
|
|||||||
|
|
||||||
public abstract Optional<Boolean> createEmptyCommit();
|
public abstract Optional<Boolean> createEmptyCommit();
|
||||||
|
|
||||||
|
public abstract Optional<Boolean> permissionOnly();
|
||||||
|
|
||||||
public abstract Optional<SubmitType> submitType();
|
public abstract Optional<SubmitType> submitType();
|
||||||
|
|
||||||
abstract ThrowingFunction<TestProjectCreation, Project.NameKey> projectCreator();
|
abstract ThrowingFunction<TestProjectCreation, Project.NameKey> projectCreator();
|
||||||
@@ -48,6 +50,8 @@ public abstract class TestProjectCreation {
|
|||||||
|
|
||||||
public abstract TestProjectCreation.Builder createEmptyCommit(boolean value);
|
public abstract TestProjectCreation.Builder createEmptyCommit(boolean value);
|
||||||
|
|
||||||
|
public abstract TestProjectCreation.Builder permissionOnly(boolean value);
|
||||||
|
|
||||||
/** Skips the empty commit on creation. This means that project's branches will not exist. */
|
/** Skips the empty commit on creation. This means that project's branches will not exist. */
|
||||||
public TestProjectCreation.Builder noEmptyCommit() {
|
public TestProjectCreation.Builder noEmptyCommit() {
|
||||||
return createEmptyCommit(false);
|
return createEmptyCommit(false);
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ import com.google.gerrit.acceptance.AbstractDaemonTest;
|
|||||||
import com.google.gerrit.acceptance.testsuite.project.TestProjectUpdate.TestPermission;
|
import com.google.gerrit.acceptance.testsuite.project.TestProjectUpdate.TestPermission;
|
||||||
import com.google.gerrit.common.data.Permission;
|
import com.google.gerrit.common.data.Permission;
|
||||||
import com.google.gerrit.entities.Project;
|
import com.google.gerrit.entities.Project;
|
||||||
|
import com.google.gerrit.entities.RefNames;
|
||||||
import com.google.gerrit.extensions.api.projects.BranchInfo;
|
import com.google.gerrit.extensions.api.projects.BranchInfo;
|
||||||
import com.google.gerrit.extensions.api.projects.ConfigInput;
|
import com.google.gerrit.extensions.api.projects.ConfigInput;
|
||||||
import com.google.gerrit.server.project.ProjectConfig;
|
import com.google.gerrit.server.project.ProjectConfig;
|
||||||
@@ -83,6 +84,13 @@ public class ProjectOperationsImplTest extends AbstractDaemonTest {
|
|||||||
.isEqualTo(ImmutableList.of("HEAD", "refs/meta/config", "refs/heads/master"));
|
.isEqualTo(ImmutableList.of("HEAD", "refs/meta/config", "refs/heads/master"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void permissionOnly() throws Exception {
|
||||||
|
Project.NameKey key = projectOperations.newProject().permissionOnly(true).create();
|
||||||
|
String head = gApi.projects().name(key.get()).head();
|
||||||
|
assertThat(head).isEqualTo(RefNames.REFS_CONFIG);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getProjectConfig() throws Exception {
|
public void getProjectConfig() throws Exception {
|
||||||
Project.NameKey key = projectOperations.newProject().create();
|
Project.NameKey key = projectOperations.newProject().create();
|
||||||
|
|||||||
Reference in New Issue
Block a user