Test that draft changes don't notify project watchers

Bug: Issue 5661
Change-Id: I1d25c54fe188549fba7c532583539f3d9d915304
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin 2017-03-02 09:44:39 +01:00
parent 4ed2216797
commit 4505305ffa

View File

@ -324,4 +324,25 @@ public class ProjectWatchIT extends AbstractDaemonTest {
// assert email notification
assertThat(sender.getMessages()).isEmpty();
}
@Test
public void watchProjectNoNotificationForDraftChange() throws Exception {
// watch project
String watchedProject = createProject("watchedProject").get();
setApiUser(user);
watch(watchedProject, null);
// push a draft change to watched project -> should not trigger email notification
setApiUser(admin);
TestRepository<InMemoryRepository> watchedRepo =
cloneProject(new Project.NameKey(watchedProject), admin);
PushOneCommit.Result r =
pushFactory
.create(db, admin.getIdent(), watchedRepo, "draft change", "a", "a1")
.to("refs/for/master%draft");
r.assertOkStatus();
// assert email notification
assertThat(sender.getMessages()).isEmpty();
}
}