From f76fee63ed9cb3a30d3c0c092d860b1cb93a481b Mon Sep 17 00:00:00 2001
From: Gerard Smyth <gerard.smyth@gmail.com>
Date: Thu, 08 May 2014 13:09:30 -0400
Subject: [PATCH] Updated the SyndicationServlet to provide an additional option to return details of the tags in the repository instead of the commits. This uses a new 'ot' request parameter to indicate the object type of the content to return, which can be ither TAG or COMMIT. If this is not provided, then COMMIT is assumed to maintain backwards compatability. If tags are returned, then the paging parameters, 'l' and 'pg' are still supported, but searching options are currently ignored.

---
 src/test/java/com/gitblit/tests/UserServiceTest.java |   36 ++++++++----------------------------
 1 files changed, 8 insertions(+), 28 deletions(-)

diff --git a/src/test/java/com/gitblit/tests/UserServiceTest.java b/src/test/java/com/gitblit/tests/UserServiceTest.java
index 710d1f3..cdb0a33 100644
--- a/src/test/java/com/gitblit/tests/UserServiceTest.java
+++ b/src/test/java/com/gitblit/tests/UserServiceTest.java
@@ -15,10 +15,6 @@
  */
 package com.gitblit.tests;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
 import java.io.File;
 import java.io.IOException;
 
@@ -26,23 +22,12 @@
 
 import com.gitblit.ConfigUserService;
 import com.gitblit.Constants.AccessRestrictionType;
-import com.gitblit.FileUserService;
 import com.gitblit.IUserService;
 import com.gitblit.models.RepositoryModel;
 import com.gitblit.models.TeamModel;
 import com.gitblit.models.UserModel;
 
-public class UserServiceTest {
-
-	@Test
-	public void testFileUserService() throws IOException {
-		File file = new File("us-test.properties");
-		file.delete();
-		IUserService service = new FileUserService(file);
-		testUsers(service);
-		testTeams(service);
-		file.delete();
-	}
+public class UserServiceTest extends GitblitUnitTest {
 
 	@Test
 	public void testConfigUserService() throws IOException {
@@ -62,13 +47,13 @@
 		// add admin and admins team
 		TeamModel admins = new TeamModel("admins");
 		admins.mailingLists.add("admins@localhost.com");
-		
+
 		admin = new UserModel("admin");
 		admin.password = "password";
 		admin.canAdmin = true;
 		admin.excludeFromFederation = true;
 		admin.teams.add(admins);
-		
+
 		service.updateUserModel(admin);
 		admin = null;
 		admins = null;
@@ -100,14 +85,9 @@
 		assertTrue(newUser.hasRepositoryPermission("repo2"));
 		assertTrue(newUser.hasRepositoryPermission("sub/repo3"));
 
-		// confirm authentication of test user
-		UserModel testUser = service.authenticate("test", "testPassword".toCharArray());
-		assertEquals("test", testUser.username);
-		assertEquals("testPassword", testUser.password);
-
 		// delete a repository role and confirm role removal from test user
 		service.deleteRepositoryRole("repo2");
-		testUser = service.getUserModel("test");
+		UserModel testUser = service.getUserModel("test");
 		assertEquals(2, testUser.permissions.size());
 
 		// delete garbage user and confirm user count
@@ -125,7 +105,7 @@
 		// confirm we have 1 team (admins)
 		assertEquals(1, service.getAllTeamNames().size());
 		assertEquals("admins", service.getAllTeamNames().get(0));
-		
+
 		RepositoryModel newrepo1 = new RepositoryModel("newrepo1", null, null, null);
 		newrepo1.accessRestriction = AccessRestrictionType.VIEW;
 		RepositoryModel NEWREPO1 = new RepositoryModel("NEWREPO1", null, null, null);
@@ -168,7 +148,7 @@
 		newrepo2.accessRestriction = AccessRestrictionType.VIEW;
 		RepositoryModel NEWREPO2 = new RepositoryModel("NEWREPO2", null, null, null);
 		NEWREPO2.accessRestriction = AccessRestrictionType.VIEW;
-		
+
 		team.addRepositoryPermission(newrepo2.name);
 		team.name = "testteam2";
 		service.updateTeamModel("testteam", team);
@@ -233,11 +213,11 @@
 		// delete both teams
 		service.deleteTeam("testteam");
 		service.deleteTeam("nextteam");
-		
+
 		// assert we still have the admins team
 		assertEquals(1, service.getAllTeamNames().size());
 		assertEquals("admins", service.getAllTeamNames().get(0));
-		
+
 		team = service.getTeamModel("admins");
 		assertEquals(1, team.mailingLists.size());
 		assertTrue(team.mailingLists.contains("admins@localhost.com"));

--
Gitblit v1.9.1