public void testUnblockRangeForNotChangeOwner() { allow(local, LABEL + "Code-Review", -2, +2, CHANGE_OWNER, "refs/heads/*"); ProjectControl u = util.user(local, DEVS); PermissionRange range = u.controlForRef("refs/heads/master").getRange(LABEL + "Code-Review"); assertFalse("u can vote -2", range.contains(-2)); assertFalse("u can vote +2", range.contains(2)); }
@Test public void testUnblockRangeOnMoreSpecificRef_Fails() { block(local, LABEL + "Code-Review", -1, +1, ANONYMOUS_USERS, "refs/heads/*"); allow(local, LABEL + "Code-Review", -2, +2, DEVS, "refs/heads/master"); ProjectControl u = util.user(local, DEVS); PermissionRange range = u.controlForRef("refs/heads/master").getRange(LABEL + "Code-Review"); assertFalse("u can't vote -2", range.contains(-2)); assertFalse("u can't vote +2", range.contains(-2)); }
@Test public void testUnblockInLocalRange_Fails() { block(util.getParentConfig(), LABEL + "Code-Review", -1, 1, ANONYMOUS_USERS, "refs/heads/*"); allow(local, LABEL + "Code-Review", -2, +2, DEVS, "refs/heads/*"); ProjectControl u = util.user(local, DEVS); PermissionRange range = u.controlForRef("refs/heads/master").getRange(LABEL + "Code-Review"); assertFalse("u can't vote -2", range.contains(-2)); assertFalse("u can't vote 2", range.contains(2)); }
@Test public void testBlockLabelRange_ParentBlocksChild() { allow(local, LABEL + "Code-Review", -2, +2, DEVS, "refs/heads/*"); block(util.getParentConfig(), LABEL + "Code-Review", -2, +2, DEVS, "refs/heads/*"); ProjectControl u = util.user(local, DEVS); PermissionRange range = u.controlForRef("refs/heads/master").getRange(LABEL + "Code-Review"); assertTrue("u can vote -1", range.contains(-1)); assertTrue("u can vote +1", range.contains(1)); assertFalse("u can't vote -2", range.contains(-2)); assertFalse("u can't vote 2", range.contains(2)); }