James Moger
2012-10-13 c658df9e87d65b08d5482cf04489cb0532ff83dd
tests/com/gitblit/tests/RpcTests.java
@@ -33,6 +33,7 @@
import org.junit.Test;
import com.gitblit.Constants.AccessRestrictionType;
import com.gitblit.Constants.AuthorizationControl;
import com.gitblit.GitBlitException.UnauthorizedException;
import com.gitblit.Keys;
import com.gitblit.RpcServlet;
@@ -164,6 +165,7 @@
      model.description = "created by RpcUtils";
      model.owner = "garbage";
      model.accessRestriction = AccessRestrictionType.VIEW;
      model.authorizationControl = AuthorizationControl.AUTHENTICATED;
      // create
      assertTrue("Failed to create repository!",
@@ -172,6 +174,7 @@
      RepositoryModel retrievedRepository = findRepository(model.name);
      assertNotNull("Failed to find " + model.name, retrievedRepository);
      assertEquals(AccessRestrictionType.VIEW, retrievedRepository.accessRestriction);
      assertEquals(AuthorizationControl.AUTHENTICATED, retrievedRepository.authorizationControl);
      // rename and change access restriciton
      String originalName = model.name;
@@ -244,7 +247,7 @@
      // Create the A-Team
      TeamModel aTeam = new TeamModel("A-Team");
      aTeam.users.add("admin");
      aTeam.repositories.add("helloworld.git");
      aTeam.addRepositoryPermission("helloworld.git");
      assertTrue(RpcUtils.createTeam(aTeam, url, account, password.toCharArray()));
      aTeam = null;
@@ -258,7 +261,7 @@
      }
      assertNotNull(aTeam);
      assertTrue(aTeam.hasUser("admin"));
      assertTrue(aTeam.hasRepository("helloworld.git"));
      assertTrue(aTeam.hasRepositoryPermission("helloworld.git"));
      RepositoryModel helloworld = null;
      Map<String, RepositoryModel> repositories = RpcUtils.getRepositories(url, account,
@@ -352,6 +355,11 @@
      // restore setting
      newValue = !newValue;
      updated.put(Keys.web.showRepositorySizes, String.valueOf(newValue));
      success = RpcUtils.updateSettings(updated, url, account, password.toCharArray());
      assertTrue("Failed to update server settings", success);
      settings = RpcUtils.getSettings(url, account, password.toCharArray());
      showSizes = settings.get(Keys.web.showRepositorySizes).getBoolean(true);
      assertEquals(newValue, showSizes);
   }
   @Test