Search in sources :

Example 16 with PermissionRange

use of com.google.gerrit.entities.PermissionRange in project gerrit by GerritCodeReview.

the class RefControlTest method unionOfPermissibleVotes.

@Test
public void unionOfPermissibleVotes() throws Exception {
    projectOperations.project(localKey).forUpdate().add(allowLabel(LabelId.CODE_REVIEW).ref("refs/heads/*").group(DEVS).range(-1, +1)).add(allowLabel(LabelId.CODE_REVIEW).ref("refs/heads/*").group(REGISTERED_USERS).range(-2, +2)).update();
    ProjectControl u = user(localKey, DEVS);
    PermissionRange range = u.controlForRef("refs/heads/master").getRange(LABEL + LabelId.CODE_REVIEW);
    assertCanVote(-2, range);
    assertCanVote(2, range);
}
Also used : PermissionRange(com.google.gerrit.entities.PermissionRange) Test(org.junit.Test)

Example 17 with PermissionRange

use of com.google.gerrit.entities.PermissionRange in project gerrit by GerritCodeReview.

the class RefControlTest method unblockRange.

@Test
public void unblockRange() throws Exception {
    projectOperations.project(localKey).forUpdate().add(blockLabel(LabelId.CODE_REVIEW).ref("refs/heads/*").group(ANONYMOUS_USERS).range(-1, +1)).add(allowLabel(LabelId.CODE_REVIEW).ref("refs/heads/*").group(DEVS).range(-2, +2)).update();
    ProjectControl u = user(localKey, DEVS);
    PermissionRange range = u.controlForRef("refs/heads/master").getRange(LABEL + LabelId.CODE_REVIEW);
    assertCanVote(-2, range);
    assertCanVote(2, range);
}
Also used : PermissionRange(com.google.gerrit.entities.PermissionRange) Test(org.junit.Test)

Aggregations

PermissionRange (com.google.gerrit.entities.PermissionRange)17 Test (org.junit.Test)15 PermissionRule (com.google.gerrit.entities.PermissionRule)2 ImmutableList (com.google.common.collect.ImmutableList)1 Permission (com.google.gerrit.entities.Permission)1 List (java.util.List)1