diff options
author | James Moger <james.moger@gitblit.com> | 2013-07-22 09:38:55 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2013-07-22 09:38:55 -0400 |
commit | a5ae3da334fc82c60d375b764065198ec54f2d31 (patch) | |
tree | 5601401e732959a27b829df20c93de98beba3dbe /src/test/java | |
parent | 5392d72bd34dcc63861d0084ebe2529523d4bb5f (diff) | |
download | gitblit-a5ae3da334fc82c60d375b764065198ec54f2d31.tar.gz gitblit-a5ae3da334fc82c60d375b764065198ec54f2d31.zip |
Added GET_USER request to RPC interface (issue-275)
Diffstat (limited to 'src/test/java')
-rw-r--r-- | src/test/java/com/gitblit/tests/RpcTests.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/java/com/gitblit/tests/RpcTests.java b/src/test/java/com/gitblit/tests/RpcTests.java index bd7f2779..2f0cffe2 100644 --- a/src/test/java/com/gitblit/tests/RpcTests.java +++ b/src/test/java/com/gitblit/tests/RpcTests.java @@ -37,6 +37,7 @@ import com.gitblit.Constants.AccessRestrictionType; import com.gitblit.Constants.AuthorizationControl;
import com.gitblit.Constants.PermissionType;
import com.gitblit.Constants.RegistrantType;
+import com.gitblit.GitBlitException.NotAllowedException;
import com.gitblit.GitBlitException.UnauthorizedException;
import com.gitblit.Keys;
import com.gitblit.RpcServlet;
@@ -102,6 +103,20 @@ public class RpcTests { list = RpcUtils.getUsers(url, "admin", "admin".toCharArray());
assertTrue("User list is empty!", list.size() > 0);
}
+
+ @Test
+ public void testGetUser() throws IOException {
+ UserModel user = null;
+ try {
+ user = RpcUtils.getUser("admin", url, null, null);
+ } catch (NotAllowedException e) {
+ }
+ assertNull("Server allows anyone to get user!", user);
+
+ user = RpcUtils.getUser("admin", url, "admin", "admin".toCharArray());
+ assertEquals("User is not the admin!", "admin", user.username);
+ assertTrue("User is not an administrator!", user.canAdmin());
+ }
@Test
public void testListTeams() throws IOException {
|