Search in sources :

Example 56 with TestAccount

use of com.google.gerrit.acceptance.TestAccount in project gerrit by GerritCodeReview.

the class AttentionSetIT method robotReviewWithNegativeLabelDoesNotAddOwnerOnWorkInProgressChanges.

@Test
public void robotReviewWithNegativeLabelDoesNotAddOwnerOnWorkInProgressChanges() throws Exception {
    TestAccount robot = accountCreator.create("robot2", "robot2@example.com", "Ro Bot", "Ro", ServiceUserClassifier.SERVICE_USERS);
    PushOneCommit.Result r = createChange();
    gApi.changes().id(r.getChangeId()).setWorkInProgress();
    requestScopeOperations.setApiUser(robot.id());
    change(r).current().review(ReviewInput.dislike());
    assertThat(r.getChange().attentionSet()).isEmpty();
}
Also used : TestAccount(com.google.gerrit.acceptance.TestAccount) PushOneCommit(com.google.gerrit.acceptance.PushOneCommit) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest) Test(org.junit.Test)

Example 57 with TestAccount

use of com.google.gerrit.acceptance.TestAccount in project gerrit by GerritCodeReview.

the class ChangeIT method rebaseAsUploaderInAttentionSet.

@Test
public void rebaseAsUploaderInAttentionSet() throws Exception {
    // Create two changes both with the same parent
    PushOneCommit.Result r = createChange();
    testRepo.reset("HEAD~1");
    PushOneCommit.Result r2 = createChange();
    // Approve and submit the first change
    RevisionApi revision = gApi.changes().id(r.getChangeId()).current();
    revision.review(ReviewInput.approve());
    revision.submit();
    TestAccount admin2 = accountCreator.admin2();
    requestScopeOperations.setApiUser(admin2.id());
    amendChangeWithUploader(r2, project, admin2);
    gApi.changes().id(r2.getChangeId()).addToAttentionSet(new AttentionSetInput(admin2.id().toString(), "manual update"));
    gApi.changes().id(r2.getChangeId()).rebase();
}
Also used : RevisionApi(com.google.gerrit.extensions.api.changes.RevisionApi) AttentionSetInput(com.google.gerrit.extensions.api.changes.AttentionSetInput) TestAccount(com.google.gerrit.acceptance.TestAccount) PushOneCommit(com.google.gerrit.acceptance.PushOneCommit) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Example 58 with TestAccount

use of com.google.gerrit.acceptance.TestAccount in project gerrit by GerritCodeReview.

the class ChangeNotificationsIT method changeAssigneeOnReviewableChange.

@Test
public void changeAssigneeOnReviewableChange() throws Exception {
    StagedChange sc = stageReviewableChange();
    TestAccount other = accountCreator.create("other", "other@example.com", "other", null);
    assign(sc, sc.owner, other);
    sender.clear();
    assign(sc, sc.owner, sc.assignee);
    assertThat(sender).sent("setassignee", sc).cc(StagedUsers.REVIEWER_BY_EMAIL, // TODO(logan): This is probably not intended!
    StagedUsers.CC_BY_EMAIL).to(sc.assignee).noOneElse();
    assertThat(sender).didNotSend();
}
Also used : TestAccount(com.google.gerrit.acceptance.TestAccount) AbstractNotificationTest(com.google.gerrit.acceptance.AbstractNotificationTest) Test(org.junit.Test)

Example 59 with TestAccount

use of com.google.gerrit.acceptance.TestAccount in project gerrit by GerritCodeReview.

the class ChangeNotificationsIT method addReviewerToWipChangeNotifyAll.

private void addReviewerToWipChangeNotifyAll(Adder adder) throws Exception {
    StagedChange sc = stageWipChange();
    TestAccount reviewer = accountCreator.create("added", "added@example.com", "added", null);
    addReviewer(adder, sc.changeId, sc.owner, reviewer.email(), NotifyHandling.ALL);
    // TODO(logan): Should CCs be included?
    assertThat(sender).sent("newchange", sc).to(reviewer).cc(sc.reviewer).cc(StagedUsers.REVIEWER_BY_EMAIL, StagedUsers.CC_BY_EMAIL).noOneElse();
    assertThat(sender).didNotSend();
}
Also used : TestAccount(com.google.gerrit.acceptance.TestAccount)

Example 60 with TestAccount

use of com.google.gerrit.acceptance.TestAccount in project gerrit by GerritCodeReview.

the class ChangeNotificationsIT method abandonReviewableChangeByOther.

@Test
public void abandonReviewableChangeByOther() throws Exception {
    StagedChange sc = stageReviewableChange();
    TestAccount other = accountCreator.create("other", "other@example.com", "other", null);
    abandon(sc.changeId, other);
    assertThat(sender).sent("abandon", sc).to(sc.owner).cc(sc.reviewer, sc.ccer).cc(StagedUsers.REVIEWER_BY_EMAIL, StagedUsers.CC_BY_EMAIL).bcc(sc.starrer).bcc(ABANDONED_CHANGES).noOneElse();
    assertThat(sender).didNotSend();
}
Also used : TestAccount(com.google.gerrit.acceptance.TestAccount) AbstractNotificationTest(com.google.gerrit.acceptance.AbstractNotificationTest) Test(org.junit.Test)

Aggregations

TestAccount (com.google.gerrit.acceptance.TestAccount)137 Test (org.junit.Test)122 AbstractDaemonTest (com.google.gerrit.acceptance.AbstractDaemonTest)106 PushOneCommit (com.google.gerrit.acceptance.PushOneCommit)54 ReviewInput (com.google.gerrit.extensions.api.changes.ReviewInput)19 AbstractNotificationTest (com.google.gerrit.acceptance.AbstractNotificationTest)15 PublicKeyStore.keyToString (com.google.gerrit.gpg.PublicKeyStore.keyToString)14 Registration (com.google.gerrit.acceptance.ExtensionRegistry.Registration)13 ArrayList (java.util.ArrayList)13 InMemoryRepository (org.eclipse.jgit.internal.storage.dfs.InMemoryRepository)12 AccountIndexedCounter (com.google.gerrit.acceptance.AccountIndexedCounter)10 ReviewerInput (com.google.gerrit.extensions.api.changes.ReviewerInput)10 AccountInfo (com.google.gerrit.extensions.common.AccountInfo)10 Message (com.google.gerrit.testing.FakeEmailSender.Message)10 GerritConfig (com.google.gerrit.acceptance.config.GerritConfig)9 EmailInput (com.google.gerrit.extensions.api.accounts.EmailInput)9 ChangeInfo (com.google.gerrit.extensions.common.ChangeInfo)9 AuthException (com.google.gerrit.extensions.restapi.AuthException)9 AttentionSetUpdate (com.google.gerrit.entities.AttentionSetUpdate)8 Change (com.google.gerrit.entities.Change)8