use of com.google.gerrit.extensions.api.changes.RevisionApi in project gerrit by GerritCodeReview.
the class StickyApprovalsIT method trivialRebase.
private void trivialRebase(String changeId) throws Exception {
setApiUser(admin);
testRepo.reset(getRemoteHead());
PushOneCommit push = pushFactory.create(db, admin.getIdent(), testRepo, "Other Change", "a" + System.nanoTime() + ".txt", PushOneCommit.FILE_CONTENT);
PushOneCommit.Result r = push.to("refs/for/master");
r.assertOkStatus();
RevisionApi revision = gApi.changes().id(r.getChangeId()).current();
ReviewInput in = new ReviewInput().label("Code-Review", 2).label("Verified", 1);
revision.review(in);
revision.submit();
gApi.changes().id(changeId).current().rebase();
assertThat(getChangeKind(changeId)).isEqualTo(TRIVIAL_REBASE);
}
use of com.google.gerrit.extensions.api.changes.RevisionApi in project gerrit by GerritCodeReview.
the class ImpersonationIT method voteOnBehalfOfRequiresLabel.
@Test
public void voteOnBehalfOfRequiresLabel() throws Exception {
allowCodeReviewOnBehalfOf();
PushOneCommit.Result r = createChange();
RevisionApi revision = gApi.changes().id(r.getChangeId()).current();
ReviewInput in = new ReviewInput();
in.onBehalfOf = user.id.toString();
in.message = "Message on behalf of";
exception.expect(AuthException.class);
exception.expectMessage("label required to post review on behalf of \"" + in.onBehalfOf + '"');
revision.review(in);
}
use of com.google.gerrit.extensions.api.changes.RevisionApi in project gerrit by GerritCodeReview.
the class ImpersonationIT method voteOnBehalfOfInvisibleUserNotAllowed.
@GerritConfig(name = "accounts.visibility", value = "SAME_GROUP")
@Test
public void voteOnBehalfOfInvisibleUserNotAllowed() throws Exception {
allowCodeReviewOnBehalfOf();
setApiUser(accounts.user2());
assertThat(accountControlFactory.get().canSee(user.id)).isFalse();
PushOneCommit.Result r = createChange();
RevisionApi revision = gApi.changes().id(r.getChangeId()).current();
ReviewInput in = new ReviewInput();
in.onBehalfOf = user.id.toString();
in.label("Code-Review", 1);
exception.expect(UnprocessableEntityException.class);
exception.expectMessage("Account Not Found: " + in.onBehalfOf);
revision.review(in);
}
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);
exception.expect(UnprocessableEntityException.class);
exception.expectMessage("Account Not Found: doesnotexist");
revision.review(in);
}
use of com.google.gerrit.extensions.api.changes.RevisionApi in project gerrit by GerritCodeReview.
the class ImpersonationIT method voteOnBehalfOfInvalidLabel.
@Test
public void voteOnBehalfOfInvalidLabel() throws Exception {
allowCodeReviewOnBehalfOf();
PushOneCommit.Result r = createChange();
RevisionApi revision = gApi.changes().id(r.getChangeId()).current();
ReviewInput in = new ReviewInput();
in.onBehalfOf = user.id.toString();
in.strictLabels = true;
in.label("Not-A-Label", 5);
exception.expect(BadRequestException.class);
exception.expectMessage("label \"Not-A-Label\" is not a configured label");
revision.review(in);
}
Aggregations