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