AbstractQueryChangesTest: Add coverage of is:mergeable

Bug: Issue 8605
Change-Id: Id4674d140afa95ff8f5475c083d51c46e05abfe3
This commit is contained in:
David Pursehouse
2018-04-16 14:06:53 +02:00
parent d434871dfb
commit a32cb27478

View File

@@ -1587,6 +1587,26 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests {
assertQuery("conflicts:" + change4.getId().get());
}
@Test
public void mergeable() throws Exception {
TestRepository<Repo> repo = createProject("repo");
RevCommit commit1 = repo.parseBody(repo.commit().add("file1", "contents1").create());
RevCommit commit2 = repo.parseBody(repo.commit().add("file1", "contents2").create());
Change change1 = insert(repo, newChangeForCommit(repo, commit1));
Change change2 = insert(repo, newChangeForCommit(repo, commit2));
assertQuery("conflicts:" + change1.getId().get(), change2);
assertQuery("conflicts:" + change2.getId().get(), change1);
assertQuery("is:mergeable", change2, change1);
gApi.changes().id(change1.getChangeId()).revision("current").review(ReviewInput.approve());
gApi.changes().id(change1.getChangeId()).revision("current").submit();
assertQuery("conflicts:" + change2.getId().get());
assertQuery("status:open is:mergeable");
assertQuery("status:open -is:mergeable", change2);
}
@Test
public void reviewedBy() throws Exception {
resetTimeWithClockStep(2, MINUTES);