Search in sources :

Example 6 with ReviewerInfo

use of com.google.gerrit.extensions.api.changes.ReviewerInfo in project gerrit by GerritCodeReview.

the class ChangeIT method addReviewerThatIsInactiveById.

@Test
public void addReviewerThatIsInactiveById() throws Exception {
    PushOneCommit.Result result = createChange();
    String username = name("new-user");
    Account.Id id = accountOperations.newAccount().username(username).inactive().create();
    ReviewerInput in = new ReviewerInput();
    in.reviewer = Integer.toString(id.get());
    ReviewerResult r = gApi.changes().id(result.getChangeId()).addReviewer(in);
    assertThat(r.input).isEqualTo(in.reviewer);
    assertThat(r.error).isNull();
    assertThat(r.reviewers).hasSize(1);
    ReviewerInfo reviewer = r.reviewers.get(0);
    assertThat(reviewer._accountId).isEqualTo(id.get());
    assertThat(reviewer.username).isEqualTo(username);
}
Also used : TestAccount(com.google.gerrit.acceptance.TestAccount) Account(com.google.gerrit.entities.Account) ReviewerResult(com.google.gerrit.extensions.api.changes.ReviewerResult) PushOneCommit(com.google.gerrit.acceptance.PushOneCommit) DeleteReviewerInput(com.google.gerrit.extensions.api.changes.DeleteReviewerInput) ReviewerInput(com.google.gerrit.extensions.api.changes.ReviewerInput) ReviewerInfo(com.google.gerrit.extensions.api.changes.ReviewerInfo) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Example 7 with ReviewerInfo

use of com.google.gerrit.extensions.api.changes.ReviewerInfo 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();
}
Also used : ReviewerResult(com.google.gerrit.extensions.api.changes.ReviewerResult) PushOneCommit(com.google.gerrit.acceptance.PushOneCommit) ReviewerInput(com.google.gerrit.extensions.api.changes.ReviewerInput) ReviewerInfo(com.google.gerrit.extensions.api.changes.ReviewerInfo) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest) Test(org.junit.Test)

Aggregations

ReviewerInfo (com.google.gerrit.extensions.api.changes.ReviewerInfo)7 AbstractDaemonTest (com.google.gerrit.acceptance.AbstractDaemonTest)5 PushOneCommit (com.google.gerrit.acceptance.PushOneCommit)5 ReviewerInput (com.google.gerrit.extensions.api.changes.ReviewerInput)5 Test (org.junit.Test)5 ReviewerResult (com.google.gerrit.extensions.api.changes.ReviewerResult)4 Account (com.google.gerrit.entities.Account)3 TestAccount (com.google.gerrit.acceptance.TestAccount)2 DeleteReviewerInput (com.google.gerrit.extensions.api.changes.DeleteReviewerInput)2 ReviewerState (com.google.gerrit.extensions.client.ReviewerState)2 AccountInfo (com.google.gerrit.extensions.common.AccountInfo)2 List (java.util.List)2 AutoValue (com.google.auto.value.AutoValue)1 MoreObjects (com.google.common.base.MoreObjects)1 Preconditions.checkNotNull (com.google.common.base.Preconditions.checkNotNull)1 Preconditions.checkState (com.google.common.base.Preconditions.checkState)1 Strings (com.google.common.base.Strings)1 ImmutableList (com.google.common.collect.ImmutableList)1 ListMultimap (com.google.common.collect.ListMultimap)1 Lists (com.google.common.collect.Lists)1