AbstractQueryChangesTest: Add back test for visible: predicate

Change Icfcb34efe removed draft workflow and at the same time removed
the 'explicitVisibleTo' test, which was testing visibility of draft
changes. As a result, the only test coverage of the visibleto: query
was removed.

Add 'explicitVisibleTo' back, but rename it to 'visible'. The implicit
visibility is already covered in the 'byPrivate' test.

Change-Id: I9be04156ce4401754cebb0c969d1b233a132735e
This commit is contained in:
David Pursehouse
2018-04-16 15:42:09 +02:00
parent a3bacd35f7
commit a540ac2c87

View File

@@ -1556,6 +1556,23 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests {
assertQuery(commit.getId().getName().substring(0, 6), change);
}
@Test
public void visible() throws Exception {
TestRepository<Repo> repo = createProject("repo");
Change change1 = insert(repo, newChange(repo));
Change change2 = insert(repo, newChange(repo));
gApi.changes().id(change2.getChangeId()).setPrivate(true, "private");
String q = "project:repo";
assertQuery(q, change2, change1);
// Second user cannot see first user's private change.
Account.Id user2 =
accountManager.authenticate(AuthRequest.forUser("anotheruser")).getAccountId();
assertQuery(q + " visibleto:" + user2.get(), change1);
}
@Test
public void byCommentBy() throws Exception {
TestRepository<Repo> repo = createProject("repo");