mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-13 00:45:44 +01:00
add securityV1Migration-Test
This commit is contained in:
@@ -56,6 +56,13 @@ class XmlSecurityV1UpdateStepTest {
|
||||
copyTestDatabaseFile(configDir, "config.xml");
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
void createSecurityV1XML(@TempDirectory.TempDir Path tempDir) throws IOException {
|
||||
Path configDir = tempDir.resolve("config");
|
||||
Files.createDirectories(configDir);
|
||||
copyTestDatabaseFile(configDir, "securityV1.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldCreatePermissionForUsersConfiguredAsAdmin() throws JAXBException {
|
||||
updateStep.doUpdate();
|
||||
@@ -81,6 +88,19 @@ class XmlSecurityV1UpdateStepTest {
|
||||
.collect(toList());
|
||||
assertThat(assignedPermission).contains("admins", "vogons");
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldMapV1PermissionsFromSecurityV1XML() throws JAXBException {
|
||||
updateStep.doUpdate();
|
||||
List<String> assignedPermission =
|
||||
assignedPermissionStore.getAll().values()
|
||||
.stream()
|
||||
.filter(a -> a.getPermission().getValue().contains("repository:"))
|
||||
.map(AssignedPermission::getName)
|
||||
.collect(toList());
|
||||
assertThat(assignedPermission).contains("scmadmin");
|
||||
assertThat(assignedPermission).contains("test");
|
||||
}
|
||||
}
|
||||
|
||||
private void copyTestDatabaseFile(Path configDir, String fileName) throws IOException {
|
||||
|
||||
Reference in New Issue
Block a user