use of com.google.gerrit.extensions.api.changes.RevisionApi in project gerrit by GerritCodeReview.
the class ImpersonationIT method voteOnBehalfOfMissingUser.
@Test
public void voteOnBehalfOfMissingUser() throws Exception {
allowCodeReviewOnBehalfOf();
PushOneCommit.Result r = createChange();
RevisionApi revision = gApi.changes().id(r.getChangeId()).current();
ReviewInput in = new ReviewInput();
in.onBehalfOf = "doesnotexist";
in.label("Code-Review", 1);
UnprocessableEntityException thrown = assertThrows(UnprocessableEntityException.class, () -> revision.review(in));
assertThat(thrown).hasMessageThat().contains("not found");
assertThat(thrown).hasMessageThat().contains("doesnotexist");
}
use of com.google.gerrit.extensions.api.changes.RevisionApi in project gerrit by GerritCodeReview.
the class CreateChangeIT method createMergeChangeAuthor.
@Test
public void createMergeChangeAuthor() throws Exception {
changeInTwoBranches("branchA", "a.txt", "branchB", "b.txt");
ChangeInput in = newMergeChangeInput("branchA", "branchB", "");
in.author = new AccountInput();
in.author.name = "Gerritless Jane";
in.author.email = "gerritlessjane@invalid";
ChangeInfo change = assertCreateSucceeds(in);
RevisionApi rApi = gApi.changes().id(change.id).current();
GitPerson author = rApi.commit(false).author;
assertThat(author).email().isEqualTo(in.author.email);
GitPerson committer = rApi.commit(false).committer;
assertThat(committer).email().isEqualTo(admin.getNameEmail().email());
}
use of com.google.gerrit.extensions.api.changes.RevisionApi 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());
}
Aggregations