use of com.google.gerrit.extensions.api.changes.ReviewerInput in project gerrit by GerritCodeReview.
the class ChangesRestApiBindingsIT method reviewerEndpoints.
@Test
public void reviewerEndpoints() throws Exception {
String changeId = createChange().getChangeId();
ReviewerInput reviewerInput = new ReviewerInput();
reviewerInput.reviewer = user.email();
RestApiCallHelper.execute(adminRestSession, REVIEWER_ENDPOINTS, () -> gApi.changes().id(changeId).addReviewer(reviewerInput), changeId, reviewerInput.reviewer);
}
use of com.google.gerrit.extensions.api.changes.ReviewerInput in project gerrit by GerritCodeReview.
the class ChangeReviewersIT method addExistingReviewerShortCircuits.
@Test
public void addExistingReviewerShortCircuits() throws Exception {
PushOneCommit.Result r = createChange();
ReviewerInput input = new ReviewerInput();
input.reviewer = user.email();
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).isEqualTo(user.id().get());
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 ChangeReviewersIT method moveCcToReviewer.
@Test
public void moveCcToReviewer() throws Exception {
// Create a change and add 'user' as CC.
String changeId = createChange().getChangeId();
ReviewerInput reviewerInput = new ReviewerInput();
reviewerInput.reviewer = user.email();
reviewerInput.state = ReviewerState.CC;
gApi.changes().id(changeId).addReviewer(reviewerInput);
// Verify that 'user' is a CC on the change and that there are no reviewers.
ChangeInfo c = gApi.changes().id(changeId).get();
Collection<AccountInfo> ccs = c.reviewers.get(CC);
assertThat(ccs).isNotNull();
assertThat(ccs).hasSize(1);
assertThat(ccs.iterator().next()._accountId).isEqualTo(user.id().get());
assertThat(c.reviewers.get(REVIEWER)).isNull();
// Move 'user' from CC to reviewer.
gApi.changes().id(changeId).addReviewer(user.id().toString());
// Verify that 'user' is a reviewer on the change now and that there are no CCs.
c = gApi.changes().id(changeId).get();
Collection<AccountInfo> reviewers = c.reviewers.get(REVIEWER);
assertThat(reviewers).isNotNull();
assertThat(reviewers).hasSize(1);
assertThat(reviewers.iterator().next()._accountId).isEqualTo(user.id().get());
assertThat(c.reviewers.get(CC)).isNull();
}
use of com.google.gerrit.extensions.api.changes.ReviewerInput in project gerrit by GerritCodeReview.
the class AttentionSetIT method ccsAreIgnored.
@Test
public void ccsAreIgnored() throws Exception {
PushOneCommit.Result r = createChange();
ReviewerInput reviewerInput = new ReviewerInput();
reviewerInput.state = ReviewerState.CC;
reviewerInput.reviewer = user.email();
change(r).addReviewer(reviewerInput);
assertThat(r.getChange().attentionSet()).isEmpty();
}
use of com.google.gerrit.extensions.api.changes.ReviewerInput in project gerrit by GerritCodeReview.
the class AttentionSetIT method removedCcRemovedFromAttentionSet.
@Test
public void removedCcRemovedFromAttentionSet() throws Exception {
PushOneCommit.Result r = createChange();
// Add cc
ReviewerInput input = new ReviewerInput();
input.reviewer = user.email();
input.state = ReviewerState.CC;
change(r).addReviewer(input);
// Add them to the attention set
AttentionSetInput attentionSetInput = new AttentionSetInput();
attentionSetInput.user = user.email();
attentionSetInput.reason = "reason";
change(r).addToAttentionSet(attentionSetInput);
// Remove them from cc
change(r).reviewer(user.email()).remove();
AttentionSetUpdate attentionSet = Iterables.getOnlyElement(r.getChange().attentionSet());
assertThat(attentionSet).hasAccountIdThat().isEqualTo(user.id());
assertThat(attentionSet).hasOperationThat().isEqualTo(AttentionSetUpdate.Operation.REMOVE);
assertThat(attentionSet).hasReasonThat().isEqualTo("Reviewer/Cc was removed");
}
Aggregations