Map properties of repositories

This commit is contained in:
René Pfeuffer
2018-07-11 13:47:41 +02:00
parent 617b98c6f3
commit 667cc48e08
3 changed files with 25 additions and 0 deletions

View File

@@ -101,6 +101,19 @@ public class RepositoryRootResourceTest {
assertTrue(response.getContentAsString().contains("\"name\":\"repo\""));
}
@Test
public void shouldMapProperties() throws URISyntaxException {
Repository repository = mockRepository("space", "repo");
repository.setProperty("testKey", "testValue");
MockHttpRequest request = MockHttpRequest.get("/" + RepositoryRootResource.REPOSITORIES_PATH_V2 + "space/repo");
MockHttpResponse response = new MockHttpResponse();
dispatcher.invoke(request, response);
assertTrue(response.getContentAsString().contains("\"testKey\":\"testValue\""));
}
@Test
public void shouldGetAll() throws URISyntaxException {
PageResult<Repository> singletonPageResult = createSingletonPageResult(mockRepository("space", "repo"));

View File

@@ -57,6 +57,16 @@ public class RepositoryToRepositoryDtoMapperTest {
assertEquals("none@example.com", dto.getContact());
}
@Test
public void shouldMapPropertiesProperty() {
Repository repository = createTestRepository();
repository.setProperty("testKey", "testValue");
RepositoryDto dto = mapper.map(repository);
assertEquals("testValue", dto.getProperties().get("testKey"));
}
@Test
@SubjectAware(username = "unpriv")
public void shouldCreateLinksForUnprivilegedUser() {