Fixed missing @Test on ITs

Modified CommunityMatcher to use the generic CommunityMetadataMatcher
This commit is contained in:
Pablo Prieto
2018-10-08 23:19:53 -05:00
parent 486b1fb41d
commit a2e7069d1c
2 changed files with 4 additions and 2 deletions

View File

@@ -36,6 +36,7 @@ import org.junit.Test;
public class CommunityRestRepositoryIT extends AbstractControllerIntegrationTest { public class CommunityRestRepositoryIT extends AbstractControllerIntegrationTest {
@Test
public void createTest() throws Exception { public void createTest() throws Exception {
context.turnOffAuthorisationSystem(); context.turnOffAuthorisationSystem();
@@ -101,6 +102,7 @@ public class CommunityRestRepositoryIT extends AbstractControllerIntegrationTest
} }
@Test
public void createUnauthorizedTest() throws Exception { public void createUnauthorizedTest() throws Exception {
context.turnOffAuthorisationSystem(); context.turnOffAuthorisationSystem();
@@ -119,7 +121,7 @@ public class CommunityRestRepositoryIT extends AbstractControllerIntegrationTest
getClient().perform(post("/api/core/communities") getClient().perform(post("/api/core/communities")
.content(mapper.writeValueAsBytes(comm)) .content(mapper.writeValueAsBytes(comm))
.contentType(contentType)) .contentType(contentType))
.andExpect(status().isForbidden()); .andExpect(status().isUnauthorized());
// Non-admin Eperson tries to create a community. // Non-admin Eperson tries to create a community.
// Should fail because user doesn't have permissions. Error 403. // Should fail because user doesn't have permissions. Error 403.

View File

@@ -37,7 +37,7 @@ public class CommunityMatcher {
hasJsonPath("$.handle", is(handle)), hasJsonPath("$.handle", is(handle)),
hasJsonPath("$.type", is("community")), hasJsonPath("$.type", is("community")),
hasJsonPath("$.metadata", Matchers.contains( hasJsonPath("$.metadata", Matchers.contains(
CommunityMetadataMatcher.matchTitle(name) CommunityMetadataMatcher.matchMetadata("dc.title", name)
)) ))
); );
} }