summaryrefslogtreecommitdiffstats
path: root/src/test/java/com/gitblit/tests/PermissionsTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/com/gitblit/tests/PermissionsTest.java')
-rw-r--r--src/test/java/com/gitblit/tests/PermissionsTest.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/java/com/gitblit/tests/PermissionsTest.java b/src/test/java/com/gitblit/tests/PermissionsTest.java
index 942811d5..42ef9935 100644
--- a/src/test/java/com/gitblit/tests/PermissionsTest.java
+++ b/src/test/java/com/gitblit/tests/PermissionsTest.java
@@ -2878,4 +2878,22 @@ public class PermissionsTest extends Assert {
assertEquals("user has wrong permission!", AccessPermission.CLONE, user.getRepositoryPermission(repo).permission);
assertEquals("team has wrong permission!", AccessPermission.CLONE, team.getRepositoryPermission(repo).permission);
}
+
+ @Test
+ public void testIsMirror() throws Exception {
+ RepositoryModel repo = new RepositoryModel("somerepo.git", null, null, new Date());
+ repo.authorizationControl = AuthorizationControl.NAMED;
+ repo.accessRestriction = AccessRestrictionType.NONE;
+
+ UserModel user = new UserModel("test");
+ TeamModel team = new TeamModel("team");
+
+ assertEquals("user has wrong permission!", AccessPermission.REWIND, user.getRepositoryPermission(repo).permission);
+ assertEquals("team has wrong permission!", AccessPermission.REWIND, team.getRepositoryPermission(repo).permission);
+
+ // set repo to be a mirror, pushes prohibited
+ repo.isMirror = true;
+ assertEquals("user has wrong permission!", AccessPermission.CLONE, user.getRepositoryPermission(repo).permission);
+ assertEquals("team has wrong permission!", AccessPermission.CLONE, team.getRepositoryPermission(repo).permission);
+ }
}