Test that watchers are notified for new changes only if notify is ALL
Change-Id: Ia33389c59ee25c4f5486168aeea98670be0af04d Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
parent
c89244818e
commit
5690d689d9
@ -43,6 +43,7 @@ import com.google.gerrit.extensions.api.projects.BranchInput;
|
||||
import com.google.gerrit.extensions.client.ChangeStatus;
|
||||
import com.google.gerrit.extensions.client.InheritableBoolean;
|
||||
import com.google.gerrit.extensions.client.ListChangesOption;
|
||||
import com.google.gerrit.extensions.client.ProjectWatchInfo;
|
||||
import com.google.gerrit.extensions.common.ChangeInfo;
|
||||
import com.google.gerrit.extensions.common.ChangeMessageInfo;
|
||||
import com.google.gerrit.extensions.common.EditInfo;
|
||||
@ -219,6 +220,17 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
|
||||
|
||||
@Test
|
||||
public void pushForMasterWithNotify() throws Exception {
|
||||
// create a user that watches the project
|
||||
TestAccount user3 = accounts.create("user3", "user3@example.com", "User3");
|
||||
List<ProjectWatchInfo> projectsToWatch = new ArrayList<>();
|
||||
ProjectWatchInfo pwi = new ProjectWatchInfo();
|
||||
pwi.project = project.get();
|
||||
pwi.filter = "*";
|
||||
pwi.notifyNewChanges = true;
|
||||
projectsToWatch.add(pwi);
|
||||
setApiUser(user3);
|
||||
gApi.accounts().self().setWatchedProjects(projectsToWatch);
|
||||
|
||||
TestAccount user2 = accounts.user2();
|
||||
String pushSpec = "refs/for/master"
|
||||
+ "%reviewer=" + user.email
|
||||
@ -248,7 +260,8 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
|
||||
r.assertOkStatus();
|
||||
assertThat(sender.getMessages()).hasSize(1);
|
||||
m = sender.getMessages().get(0);
|
||||
assertThat(m.rcpt()).containsExactly(user.emailAddress, user2.emailAddress);
|
||||
assertThat(m.rcpt()).containsExactly(user.emailAddress, user2.emailAddress,
|
||||
user3.emailAddress);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user