mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-13 08:55:44 +01:00
create scmadmin also if only _anonymous user exists
This commit is contained in:
@@ -70,7 +70,19 @@ class SetupContextListenerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldCreateAdminAccountAndAssignPermissions() {
|
||||
void shouldCreateAdminAccountIfNoUserExistsAndAssignPermissions() {
|
||||
when(passwordService.encryptPassword("scmadmin")).thenReturn("secret");
|
||||
|
||||
setupContextListener.contextInitialized(null);
|
||||
|
||||
verifyAdminCreated();
|
||||
verifyAdminPermissionsAssigned();
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldCreateAdminAccountIfOnlyAnonymousUserExistsAndAssignPermissions() {
|
||||
when(userManager.getAll()).thenReturn(Lists.newArrayList(SCMContext.ANONYMOUS));
|
||||
when(userManager.contains(SCMContext.USER_ANONYMOUS)).thenReturn(true);
|
||||
when(passwordService.encryptPassword("scmadmin")).thenReturn("secret");
|
||||
|
||||
setupContextListener.contextInitialized(null);
|
||||
|
||||
Reference in New Issue
Block a user