use of com.google.gerrit.entities.PermissionRange in project gerrit by GerritCodeReview.
the class RefControlTest method unblockRangeForChangeOwner.
@Test
public void unblockRangeForChangeOwner() throws Exception {
projectOperations.project(localKey).forUpdate().add(allowLabel(LabelId.CODE_REVIEW).ref("refs/heads/*").group(CHANGE_OWNER).range(-2, +2)).update();
ProjectControl u = user(localKey, DEVS);
PermissionRange range = u.controlForRef("refs/heads/master").getRange(LABEL + LabelId.CODE_REVIEW, true);
assertCanVote(-2, range);
assertCanVote(2, range);
}
use of com.google.gerrit.entities.PermissionRange in project gerrit by GerritCodeReview.
the class RefControlTest method blockLabelRange_ParentBlocksChild.
@Test
public void blockLabelRange_ParentBlocksChild() throws Exception {
projectOperations.project(localKey).forUpdate().add(allowLabel(LabelId.CODE_REVIEW).ref("refs/heads/*").group(DEVS).range(-2, +2)).update();
projectOperations.project(parentKey).forUpdate().add(blockLabel(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(-1, range);
assertCanVote(1, range);
assertCannotVote(-2, range);
assertCannotVote(2, range);
}
use of com.google.gerrit.entities.PermissionRange in project gerrit by GerritCodeReview.
the class RefControlTest method unblockVoteMoreSpecificRefWithExclusiveFlag.
@Test
public void unblockVoteMoreSpecificRefWithExclusiveFlag() 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/master").group(DEVS).range(-2, 2)).setExclusiveGroup(labelPermissionKey(LabelId.CODE_REVIEW).ref("refs/heads/master"), true).update();
ProjectControl u = user(localKey, DEVS);
PermissionRange range = u.controlForRef("refs/heads/master").getRange(LABEL + LabelId.CODE_REVIEW);
assertCanVote(-2, range);
}
use of com.google.gerrit.entities.PermissionRange in project gerrit by GerritCodeReview.
the class RefControlTest method unionOfPermissibleVotesPermissionOrder.
@Test
public void unionOfPermissibleVotesPermissionOrder() throws Exception {
projectOperations.project(localKey).forUpdate().add(allowLabel(LabelId.CODE_REVIEW).ref("refs/heads/*").group(REGISTERED_USERS).range(-2, +2)).add(allowLabel(LabelId.CODE_REVIEW).ref("refs/heads/*").group(DEVS).range(-1, +1)).update();
ProjectControl u = user(localKey, DEVS);
PermissionRange range = u.controlForRef("refs/heads/master").getRange(LABEL + LabelId.CODE_REVIEW);
assertCanVote(-2, range);
assertCanVote(2, range);
}
use of com.google.gerrit.entities.PermissionRange in project gerrit by GerritCodeReview.
the class RefControlTest method unblockRangeForNotChangeOwner.
@Test
public void unblockRangeForNotChangeOwner() throws Exception {
projectOperations.project(localKey).forUpdate().add(allowLabel(LabelId.CODE_REVIEW).ref("refs/heads/*").group(CHANGE_OWNER).range(-2, +2)).update();
ProjectControl u = user(localKey, DEVS);
PermissionRange range = u.controlForRef("refs/heads/master").getRange(LABEL + LabelId.CODE_REVIEW);
assertCannotVote(-2, range);
assertCannotVote(2, range);
}
Aggregations