use of com.google.gerrit.extensions.api.changes.ReviewerInput in project gerrit by GerritCodeReview.
the class ChangesRestApiBindingsIT method revisionReviewerEndpoints.
@Test
public void revisionReviewerEndpoints() throws Exception {
String changeId = createChange().getChangeId();
ReviewerInput reviewerInput = new ReviewerInput();
reviewerInput.reviewer = user.email();
RestApiCallHelper.execute(adminRestSession, REVISION_REVIEWER_ENDPOINTS, () -> gApi.changes().id(changeId).addReviewer(reviewerInput), changeId, "current", reviewerInput.reviewer);
}
use of com.google.gerrit.extensions.api.changes.ReviewerInput in project gerrit by GerritCodeReview.
the class ChangeReviewersByEmailIT method convertFromCCToReviewer.
@Test
public void convertFromCCToReviewer() throws Exception {
AccountInfo acc = new AccountInfo("Foo Bar", "foo.bar@gerritcodereview.com");
PushOneCommit.Result r = createChange();
ReviewerInput addInput = new ReviewerInput();
addInput.reviewer = toRfcAddressString(acc);
addInput.state = ReviewerState.CC;
gApi.changes().id(r.getChangeId()).addReviewer(addInput);
ReviewerInput modifyInput = new ReviewerInput();
modifyInput.reviewer = addInput.reviewer;
modifyInput.state = ReviewerState.REVIEWER;
gApi.changes().id(r.getChangeId()).addReviewer(modifyInput);
ChangeInfo info = gApi.changes().id(r.getChangeId()).get(DETAILED_LABELS);
assertThat(info.reviewers).isEqualTo(ImmutableMap.of(ReviewerState.REVIEWER, ImmutableList.of(acc)));
}
use of com.google.gerrit.extensions.api.changes.ReviewerInput in project gerrit by GerritCodeReview.
the class ChangeReviewersByEmailIT method addExistingReviewerByEmailShortCircuits.
@Test
public void addExistingReviewerByEmailShortCircuits() throws Exception {
PushOneCommit.Result r = createChange();
ReviewerInput input = new ReviewerInput();
input.reviewer = "nonexisting@example.com";
input.state = ReviewerState.REVIEWER;
ReviewerResult result = gApi.changes().id(r.getChangeId()).addReviewer(input);
assertThat(result.reviewers).hasSize(1);
ReviewerInfo info = result.reviewers.get(0);
assertThat(info._accountId).isNull();
assertThat(info.email).isEqualTo(input.reviewer);
assertThat(gApi.changes().id(r.getChangeId()).addReviewer(input).reviewers).isEmpty();
}
use of com.google.gerrit.extensions.api.changes.ReviewerInput in project gerrit by GerritCodeReview.
the class AttentionSetIT method addingReviewerWhileMarkingWorkInProgressDoesntAddToAttentionSet.
@Test
public void addingReviewerWhileMarkingWorkInProgressDoesntAddToAttentionSet() throws Exception {
PushOneCommit.Result r = createChange();
ReviewInput reviewInput = ReviewInput.create().setWorkInProgress(true);
ReviewerInput reviewerInput = new ReviewerInput();
reviewerInput.state = ReviewerState.REVIEWER;
reviewerInput.reviewer = user.email();
reviewInput.reviewers = ImmutableList.of(reviewerInput);
change(r).current().review(reviewInput);
assertThat(getAttentionSetUpdatesForUser(r, user)).isEmpty();
}
use of com.google.gerrit.extensions.api.changes.ReviewerInput in project gerrit by GerritCodeReview.
the class AttentionSetIT method readyForReviewWhileRemovingReviewerRemovesThemToAttentionSet.
@Test
public void readyForReviewWhileRemovingReviewerRemovesThemToAttentionSet() throws Exception {
PushOneCommit.Result r = createChange();
change(r).setWorkInProgress();
change(r).addReviewer(user.email());
ReviewInput reviewInput = ReviewInput.create().setReady(true);
ReviewerInput reviewerInput = new ReviewerInput();
reviewerInput.state = ReviewerState.CC;
reviewerInput.reviewer = user.email();
reviewInput.reviewers = ImmutableList.of(reviewerInput);
change(r).addToAttentionSet(new AttentionSetInput(user.email(), "reason"));
change(r).current().review(reviewInput);
AttentionSetUpdate attentionSet = Iterables.getOnlyElement(getAttentionSetUpdatesForUser(r, user));
assertThat(attentionSet).hasAccountIdThat().isEqualTo(user.id());
assertThat(attentionSet).hasOperationThat().isEqualTo(AttentionSetUpdate.Operation.REMOVE);
assertThat(attentionSet).hasReasonThat().isEqualTo("Reviewer/Cc was removed");
}
Aggregations