summaryrefslogtreecommitdiffstats
path: root/src/test/java
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2013-07-02 15:01:15 -0400
committerJames Moger <james.moger@gitblit.com>2013-07-02 15:01:15 -0400
commitd91ce5ee15581f6c5af49083e2f9fc5fd8ffca67 (patch)
tree28e8313aeec25ff3b397603e5de5f1d2bd22601c /src/test/java
parente1e9744f8bbd9d6931e31a56591d86a7077a3cf6 (diff)
downloadgitblit-d91ce5ee15581f6c5af49083e2f9fc5fd8ffca67.tar.gz
gitblit-d91ce5ee15581f6c5af49083e2f9fc5fd8ffca67.zip
Fix RPC unit test
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/com/gitblit/tests/RpcTests.java18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/test/java/com/gitblit/tests/RpcTests.java b/src/test/java/com/gitblit/tests/RpcTests.java
index f8fdf6f9..bd7f2779 100644
--- a/src/test/java/com/gitblit/tests/RpcTests.java
+++ b/src/test/java/com/gitblit/tests/RpcTests.java
@@ -172,6 +172,7 @@ public class RpcTests {
model.authorizationControl = AuthorizationControl.AUTHENTICATED;
// create
+ RpcUtils.deleteRepository(model, url, account, password.toCharArray());
assertTrue("Failed to create repository!",
RpcUtils.createRepository(model, url, account, password.toCharArray()));
@@ -183,24 +184,31 @@ public class RpcTests {
// rename and change access restriciton
String originalName = model.name;
model.name = "garbagerepo2.git";
- model.accessRestriction = AccessRestrictionType.PUSH;
+ model.accessRestriction = AccessRestrictionType.CLONE;
model.authorizationControl = AuthorizationControl.NAMED;
+ RpcUtils.deleteRepository(model, url, account, password.toCharArray());
assertTrue("Failed to update repository!", RpcUtils.updateRepository(originalName, model,
url, account, password.toCharArray()));
retrievedRepository = findRepository(model.name);
assertNotNull("Failed to find " + model.name, retrievedRepository);
assertTrue("Access retriction type is wrong",
- AccessRestrictionType.PUSH.equals(retrievedRepository.accessRestriction));
+ AccessRestrictionType.CLONE.equals(retrievedRepository.accessRestriction));
+ // restore VIEW restriction
+ retrievedRepository.accessRestriction = AccessRestrictionType.VIEW;
+ assertTrue("Failed to update repository!", RpcUtils.updateRepository(retrievedRepository.name, retrievedRepository,
+ url, account, password.toCharArray()));
+ retrievedRepository = findRepository(retrievedRepository.name);
+
// memberships
UserModel testMember = new UserModel("justadded");
assertTrue(RpcUtils.createUser(testMember, url, account, password.toCharArray()));
List<RegistrantAccessPermission> permissions = RpcUtils.getRepositoryMemberPermissions(retrievedRepository, url, account,
password.toCharArray());
- assertEquals("Membership permissions is not empty!", 0, permissions.size());
- permissions.add(new RegistrantAccessPermission(testMember.username, AccessPermission.PUSH, PermissionType.EXPLICIT, RegistrantType.USER, null, true));
+ assertEquals("Unexpected permissions! " + permissions.toString(), 1, permissions.size());
+ permissions.add(new RegistrantAccessPermission(testMember.username, AccessPermission.VIEW, PermissionType.EXPLICIT, RegistrantType.USER, null, true));
assertTrue(
"Failed to set member permissions!",
RpcUtils.setRepositoryMemberPermissions(retrievedRepository, permissions, url, account,
@@ -211,7 +219,7 @@ public class RpcTests {
for (RegistrantAccessPermission permission : permissions) {
if (permission.registrant.equalsIgnoreCase(testMember.username)) {
foundMember = true;
- assertEquals(AccessPermission.PUSH, permission.permission);
+ assertEquals(AccessPermission.VIEW, permission.permission);
break;
}
}