mirror of
https://github.com/jlengrand/github-api.git
synced 2026-04-05 08:21:21 +00:00
Merge branch 'master' into issue/682
This commit is contained in:
16
src/test/java/org/kohsuke/github/GHBranchProtectionTest.java
Normal file → Executable file
16
src/test/java/org/kohsuke/github/GHBranchProtectionTest.java
Normal file → Executable file
@@ -54,6 +54,14 @@ public class GHBranchProtectionTest extends AbstractGitHubWireMockTest {
|
||||
assertTrue(repo.getBranch(BRANCH).isProtected());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDisableProtectionOnly() throws Exception {
|
||||
GHBranchProtection protection = branch.enableProtection().enable();
|
||||
assertTrue(repo.getBranch(BRANCH).isProtected());
|
||||
branch.disableProtection();
|
||||
assertFalse(repo.getBranch(BRANCH).isProtected());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEnableRequireReviewsOnly() throws Exception {
|
||||
GHBranchProtection protection = branch.enableProtection().requireReviews().enable();
|
||||
@@ -73,4 +81,12 @@ public class GHBranchProtectionTest extends AbstractGitHubWireMockTest {
|
||||
protection.disableSignedCommits();
|
||||
assertFalse(protection.getRequiredSignatures());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetProtection() throws Exception {
|
||||
GHBranchProtection protection = branch.enableProtection().enable();
|
||||
GHBranchProtection protectionTest = repo.getBranch(BRANCH).getProtection();
|
||||
assertTrue(protectionTest instanceof GHBranchProtection);
|
||||
assertTrue(repo.getBranch(BRANCH).isProtected());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user