Merge "Add a test for setting the reviewed flag with multiple patch sets"

This commit is contained in:
Edwin Kempin 2020-03-30 08:06:48 +00:00 committed by Gerrit Code Review
commit ca17ea1839

@ -1078,6 +1078,24 @@ public class RevisionIT extends AbstractDaemonTest {
assertThat(gApi.changes().id(r.getChangeId()).current().reviewed()).isEmpty();
}
@Test
public void setReviewedFlagWithMultiplePatchSets() throws Exception {
PushOneCommit push = pushFactory.create(admin.newIdent(), testRepo);
PushOneCommit.Result r1 = push.to("refs/for/master");
gApi.changes().id(r1.getChangeId()).current().setReviewed(PushOneCommit.FILE_NAME, true);
/** Amending the change will result in the file being un-reviewed in the latest patchset */
PushOneCommit.Result r2 = amendChange(r1.getChangeId());
assertThat(gApi.changes().id(r2.getChangeId()).current().reviewed()).isEmpty();
gApi.changes().id(r2.getChangeId()).current().setReviewed(PushOneCommit.FILE_NAME, true);
assertThat(Iterables.getOnlyElement(gApi.changes().id(r2.getChangeId()).current().reviewed()))
.isEqualTo(PushOneCommit.FILE_NAME);
}
@Test
public void setUnsetReviewedFlagByFileApi() throws Exception {
PushOneCommit push = pushFactory.create(admin.newIdent(), testRepo);