String password = GitBlitSuite.password;\r
\r
private static final AtomicBoolean started = new AtomicBoolean(false);\r
+ \r
+ private static UserModel getUser() {\r
+ UserModel user = new UserModel("james");\r
+ user.password = "james";\r
+ return user;\r
+ }\r
+ \r
+ private static void delete(UserModel user) {\r
+ if (GitBlit.self().getUserModel(user.username) != null) {\r
+ GitBlit.self().deleteUser(user.username);\r
+ }\r
+ }\r
\r
@BeforeClass\r
public static void startGitblit() throws Exception {\r
started.set(GitBlitSuite.startGitblit());\r
+\r
+ delete(getUser());\r
}\r
\r
@AfterClass\r
GitBlitSuite.stopGitblit();\r
deleteWorkingFolders();\r
}\r
+ \r
+ delete(getUser());\r
}\r
\r
public static void deleteWorkingFolders() throws Exception {\r
model.accessRestriction = AccessRestrictionType.NONE;\r
model.authorizationControl = AuthorizationControl.NAMED;\r
GitBlit.self().updateRepositoryModel(model.name, model, false);\r
- GitBlit.self().deleteUser(user.username);\r
+ \r
+ delete(user); \r
}\r
\r
@Test\r
\r
@Test\r
public void testCommitterVerification() throws Exception {\r
- UserModel user = new UserModel("james");\r
- user.password = "james";\r
+ UserModel user = getUser();\r
\r
// account only uses account name to verify\r
testCommitterVerification(user, user.username, null, true);\r
\r
private void testCommitterVerification(UserModel user, String displayName, String emailAddress, boolean expectedSuccess) throws Exception {\r
\r
- if (GitBlit.self().getUserModel(user.username) != null) {\r
- GitBlit.self().deleteUser(user.username);\r
- }\r
+ delete(user);\r
\r
CredentialsProvider cp = new UsernamePasswordCredentialsProvider(user.username, user.password);\r
\r
\r
private void testRefChange(AccessPermission permission, Status expectedCreate, Status expectedDelete, Status expectedRewind) throws Exception {\r
\r
- UserModel user = new UserModel("james");\r
- user.password = "james";\r
- \r
- if (GitBlit.self().getUserModel(user.username) != null) {\r
- GitBlit.self().deleteUser(user.username);\r
- }\r
+ UserModel user = getUser();\r
+ delete(user);\r
\r
CredentialsProvider cp = new UsernamePasswordCredentialsProvider(user.username, user.password);\r
\r
// close serving repository\r
GitBlitSuite.close(refChecks);\r
\r
- GitBlit.self().deleteUser(user.username);\r
+ delete(user);\r
}\r
\r
@Test\r
UserModel user = new UserModel("sampleuser");\r
user.password = user.username;\r
\r
- if (GitBlit.self().getUserModel(user.username) != null) {\r
- GitBlit.self().deleteUser(user.username);\r
- }\r
+ delete(user);\r
\r
user.canCreate = canCreate;\r
user.canAdmin = canAdmin;\r
}\r
\r
GitBlitSuite.close(git);\r
- GitBlit.self().deleteUser(user.username);\r
+ delete(user);\r
}\r
\r
@Test\r