OutputStreamQuery: fix comments with current-patch-set option

Comments were added at the change level but were not added at the
patch set level when using with current-patch-set option.

Change-Id: I85336d67ad9aafe972ecfd86f95175093d4449cd
This commit is contained in:
Hugo Arès
2016-02-09 14:02:16 -05:00
committed by David Pursehouse
parent 014f1e4e16
commit 61af5c11d8
2 changed files with 29 additions and 0 deletions

View File

@@ -196,6 +196,31 @@ public class QueryIT extends AbstractDaemonTest {
assertThat(changes.get(0).comments.size()).isEqualTo(1);
}
@Test
public void testCommentOptionsInCurrentPatchSetJSON() throws Exception {
String changeId = createChange().getChangeId();
ReviewInput review = new ReviewInput();
ReviewInput.CommentInput comment = new ReviewInput.CommentInput();
comment.path = PushOneCommit.FILE_NAME;
comment.side = Side.REVISION;
comment.message = "comment 1";
review.comments = new HashMap<>();
review.comments.put(comment.path, Lists.newArrayList(comment));
gApi.changes().id(changeId).current().review(review);
List<ChangeAttribute> changes =
executeSuccessfulQuery("--current-patch-set " + changeId);
assertThat(changes.size()).isEqualTo(1);
assertThat(changes.get(0).currentPatchSet.comments).isNull();
changes =
executeSuccessfulQuery("--current-patch-set --comments " + changeId);
assertThat(changes.size()).isEqualTo(1);
assertThat(changes.get(0).currentPatchSet.comments).isNotNull();
assertThat(changes.get(0).currentPatchSet.comments.size()).isEqualTo(1);
}
@Test
public void testCommentOptionInPatchSetsJSON() throws Exception {
String changeId = createChange().getChangeId();