use of com.google.gerrit.extensions.common.ChangeInput in project gerrit by GerritCodeReview.
the class CreateChangeIT method canCreateChangeOnRefsMetaDashboards.
@Test
public void canCreateChangeOnRefsMetaDashboards() throws Exception {
String branchName = "refs/meta/dashboards/project_1";
requestScopeOperations.setApiUser(admin.id());
projectOperations.project(project).forUpdate().add(allow(CREATE).ref(branchName).group(REGISTERED_USERS)).add(allow(READ).ref(branchName).group(REGISTERED_USERS)).update();
BranchNameKey branchNameKey = BranchNameKey.create(project, branchName);
createBranch(branchNameKey);
requestScopeOperations.setApiUser(user.id());
ChangeInput ci = newChangeInput(ChangeStatus.NEW);
ci.subject = "Subject";
ci.branch = branchName;
assertThat(gApi.changes().create(ci).info().branch).isEqualTo(branchName);
}
use of com.google.gerrit.extensions.common.ChangeInput in project gerrit by GerritCodeReview.
the class CreateChangeIT method createNewWorkInProgressChange.
@Test
public void createNewWorkInProgressChange() throws Exception {
ChangeInput input = newChangeInput(ChangeStatus.NEW);
input.workInProgress = true;
assertCreateSucceeds(input);
}
use of com.google.gerrit.extensions.common.ChangeInput in project gerrit by GerritCodeReview.
the class CreateChangeIT method createNewChangeSignedOffByFooterWithChangeId.
@Test
public void createNewChangeSignedOffByFooterWithChangeId() throws Exception {
setSignedOffByFooter(true);
try {
ChangeInput ci = newChangeInput(ChangeStatus.NEW);
String changeId = "I1234000000000000000000000000000000000000";
String changeIdLine = "Change-Id: " + changeId;
ci.subject = "Subject\n\n" + changeIdLine;
ChangeInfo info = assertCreateSucceeds(ci);
assertThat(info.changeId).isEqualTo(changeId);
String message = info.revisions.get(info.currentRevision).commit.message;
assertThat(message).contains(changeIdLine);
assertThat(message).contains(String.format("%sAdministrator <%s>", SIGNED_OFF_BY_TAG, admin.newIdent().getEmailAddress()));
} finally {
setSignedOffByFooter(false);
}
}
use of com.google.gerrit.extensions.common.ChangeInput in project gerrit by GerritCodeReview.
the class CreateChangeIT method createNewPrivateChange.
@Test
public void createNewPrivateChange() throws Exception {
ChangeInput input = newChangeInput(ChangeStatus.NEW);
input.isPrivate = true;
assertCreateSucceeds(input);
}
use of com.google.gerrit.extensions.common.ChangeInput in project gerrit by GerritCodeReview.
the class CreateChangeIT method createChangeOnNonExistingBranchNotPermitted.
@Test
public void createChangeOnNonExistingBranchNotPermitted() throws Exception {
projectOperations.project(project).forUpdate().add(allow(READ).ref("refs/meta/config").group(REGISTERED_USERS)).add(block(READ).ref("refs/heads/*").group(REGISTERED_USERS)).update();
requestScopeOperations.setApiUser(user.id());
ChangeInput input = newChangeInput(ChangeStatus.NEW);
input.branch = "foo";
// sets this option to be true to make sure permission check happened before this option could
// be considered.
input.newBranch = true;
assertCreateFails(input, ResourceNotFoundException.class, "ref refs/heads/foo not found");
}
Aggregations