Test unblock vote on more specific ref

Change-Id: Iaa130f7df1540843e86003ae0bafe5ec8456c4b6
This commit is contained in:
Han-Wen Nienhuys
2018-02-08 17:33:19 +01:00
parent 0f8251004a
commit e0e6d99b97
2 changed files with 26 additions and 0 deletions

View File

@@ -27,6 +27,7 @@ import static com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS
import static com.google.gerrit.server.project.testing.Util.ADMIN;
import static com.google.gerrit.server.project.testing.Util.DEVS;
import static com.google.gerrit.server.project.testing.Util.allow;
import static com.google.gerrit.server.project.testing.Util.allowExclusive;
import static com.google.gerrit.server.project.testing.Util.block;
import static com.google.gerrit.server.project.testing.Util.deny;
import static com.google.gerrit.server.project.testing.Util.doNotInherit;
@@ -670,6 +671,18 @@ public class RefControlTest {
assertCanUpdate("refs/heads/master", u);
}
@Test
public void unblockVoteMoreSpecificRefWithExclusiveFlag() {
String perm = LABEL + "Code-Review";
block(local, perm, -1, 1, ANONYMOUS_USERS, "refs/heads/*");
allowExclusive(local, perm, -2, 2, DEVS, "refs/heads/master");
ProjectControl u = user(local, DEVS);
PermissionRange range = u.controlForRef("refs/heads/master").getRange(perm);
assertCanVote(-2, range);
}
@Test
public void unblockFromParentDoesNotAffectChild() {
allow(parent, PUSH, DEVS, "refs/heads/master", true);