use of com.google.gerrit.extensions.common.ChangeInput in project gerrit by GerritCodeReview.
the class CreateChangeIT method createAuthorOverride.
@Test
public void createAuthorOverride() throws Exception {
ChangeInput input = newChangeInput(ChangeStatus.NEW);
input.author = new AccountInput();
input.author.email = "gerritlessjane@invalid";
// This is an email address that doesn't exist as account on the Gerrit server.
input.author.name = "Gerritless Jane";
ChangeInfo info = assertCreateSucceeds(input);
RevisionApi rApi = gApi.changes().id(info.id).current();
GitPerson author = rApi.commit(false).author;
assertThat(author).email().isEqualTo(input.author.email);
assertThat(author).name().isEqualTo(input.author.name);
GitPerson committer = rApi.commit(false).committer;
assertThat(committer).email().isEqualTo(admin.getNameEmail().email());
}
use of com.google.gerrit.extensions.common.ChangeInput in project gerrit by GerritCodeReview.
the class CreateChangeIT method createMergeChange_Conflicts.
@Test
public void createMergeChange_Conflicts() throws Exception {
changeInTwoBranches("branchA", "shared.txt", "branchB", "shared.txt");
ChangeInput in = newMergeChangeInput("branchA", "branchB", "");
assertCreateFails(in, RestApiException.class, "merge conflict");
}
use of com.google.gerrit.extensions.common.ChangeInput in project gerrit by GerritCodeReview.
the class CreateChangeIT method createMergeChange_Conflicts_Ours.
@Test
public void createMergeChange_Conflicts_Ours() throws Exception {
changeInTwoBranches("branchA", "shared.txt", "branchB", "shared.txt");
ChangeInput in = newMergeChangeInput("branchA", "branchB", "ours");
assertCreateSucceeds(in);
}
use of com.google.gerrit.extensions.common.ChangeInput in project gerrit by GerritCodeReview.
the class CreateChangeIT method createNewChange_InvalidCommentInCommitMessage.
@Test
public void createNewChange_InvalidCommentInCommitMessage() throws Exception {
ChangeInput ci = newChangeInput(ChangeStatus.NEW);
ci.subject = "#12345 Test";
assertCreateFails(ci, BadRequestException.class, "commit message must be non-empty");
}
use of com.google.gerrit.extensions.common.ChangeInput in project gerrit by GerritCodeReview.
the class CreateChangeIT method createChangeWithoutAccessToParentCommitFails.
@Test
public void createChangeWithoutAccessToParentCommitFails() throws Exception {
Map<String, PushOneCommit.Result> results = changeInTwoBranches("invisible-branch", "a.txt", "visible-branch", "b.txt");
projectOperations.project(project).forUpdate().add(block(READ).ref("refs/heads/invisible-branch").group(REGISTERED_USERS)).update();
ChangeInput in = newChangeInput(ChangeStatus.NEW);
in.branch = "visible-branch";
in.baseChange = results.get("invisible-branch").getChangeId();
assertCreateFails(in, UnprocessableEntityException.class, "Base change not found: " + in.baseChange);
}
Aggregations