Align test with the contract

This commit is contained in:
Andrea Bollini
2020-06-18 12:55:58 +02:00
parent 94581761b9
commit ae60714f7d

View File

@@ -147,7 +147,7 @@ public class VocabularyRestRepositoryIT extends AbstractControllerIntegrationTes
get("/api/submission/vocabularies/srsc/entries") get("/api/submission/vocabularies/srsc/entries")
.param("metadata", "dc.subject") .param("metadata", "dc.subject")
.param("collection", collection.getID().toString()) .param("collection", collection.getID().toString())
.param("query", "Research") .param("filter", "Research")
.param("size", "2")) .param("size", "2"))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.vocabularyEntries", Matchers.containsInAnyOrder( .andExpect(jsonPath("$._embedded.vocabularyEntries", Matchers.containsInAnyOrder(
@@ -169,7 +169,7 @@ public class VocabularyRestRepositoryIT extends AbstractControllerIntegrationTes
getClient(token).perform(get("/api/submission/vocabularies/srsc/entries") getClient(token).perform(get("/api/submission/vocabularies/srsc/entries")
.param("metadata", "dc.subject") .param("metadata", "dc.subject")
.param("collection", UUID.randomUUID().toString()) .param("collection", UUID.randomUUID().toString())
.param("query", "Research")) .param("filter", "Research"))
.andExpect(status().isUnprocessableEntity()); .andExpect(status().isUnprocessableEntity());
} }
@@ -178,7 +178,7 @@ public class VocabularyRestRepositoryIT extends AbstractControllerIntegrationTes
String token = getAuthToken(admin.getEmail(), password); String token = getAuthToken(admin.getEmail(), password);
getClient(token).perform(get("/api/submission/vocabularies/srsc/entries") getClient(token).perform(get("/api/submission/vocabularies/srsc/entries")
.param("metadata", "dc.subject") .param("metadata", "dc.subject")
.param("query", "Research")) .param("filter", "Research"))
.andExpect(status().isBadRequest()); .andExpect(status().isBadRequest());
} }
@@ -192,10 +192,10 @@ public class VocabularyRestRepositoryIT extends AbstractControllerIntegrationTes
context.restoreAuthSystemState(); context.restoreAuthSystemState();
String token = getAuthToken(admin.getEmail(), password); String token = getAuthToken(admin.getEmail(), password);
getClient(token).perform(get("/api/submission/vocabularies/srsc/entries") getClient(token).perform(get("/api/submission/vocabularies/srsc/entries")
.param("metadata", "dc.subject") .param("metadata", "dc.type")
.param("collection", collection.getID().toString()) .param("collection", collection.getID().toString())
.param("query", "Research")) .param("filter", "Research"))
.andExpect(status().isBadRequest()); .andExpect(status().isUnprocessableEntity());
} }
@Test @Test
@@ -227,7 +227,7 @@ public class VocabularyRestRepositoryIT extends AbstractControllerIntegrationTes
get("/api/submission/vocabularies/srsc/entries") get("/api/submission/vocabularies/srsc/entries")
.param("metadata", "dc.subject") .param("metadata", "dc.subject")
.param("collection", collection.getID().toString()) .param("collection", collection.getID().toString())
.param("query", "Research2") .param("filter", "Research2")
.param("size", "1000")) .param("size", "1000"))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(jsonPath("$.page.totalElements", Matchers.is(0))); .andExpect(jsonPath("$.page.totalElements", Matchers.is(0)));
@@ -270,7 +270,7 @@ public class VocabularyRestRepositoryIT extends AbstractControllerIntegrationTes
getClient(token).perform(get("/api/submission/vocabularies/common_types/entries") getClient(token).perform(get("/api/submission/vocabularies/common_types/entries")
.param("metadata", "dc.type") .param("metadata", "dc.type")
.param("collection", collection.getID().toString()) .param("collection", collection.getID().toString())
.param("query", "Book") .param("filter", "Book")
.param("size", "2")) .param("size", "2"))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.vocabularyEntries", Matchers.containsInAnyOrder( .andExpect(jsonPath("$._embedded.vocabularyEntries", Matchers.containsInAnyOrder(
@@ -295,7 +295,7 @@ public class VocabularyRestRepositoryIT extends AbstractControllerIntegrationTes
get("/api/submission/vocabularies/SolrAuthorAuthority/entries") get("/api/submission/vocabularies/SolrAuthorAuthority/entries")
.param("metadata", "dc.contributor.author") .param("metadata", "dc.contributor.author")
.param("collection", collection.getID().toString()) .param("collection", collection.getID().toString())
.param("query", "Shirasaka") .param("filter", "Shirasaka")
.param("size", "1000")) .param("size", "1000"))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(jsonPath("$.page.totalElements", Matchers.is(1))); .andExpect(jsonPath("$.page.totalElements", Matchers.is(1)));
@@ -314,7 +314,7 @@ public class VocabularyRestRepositoryIT extends AbstractControllerIntegrationTes
get("/api/submission/vocabularies/SolrAuthorAuthority/entries") get("/api/submission/vocabularies/SolrAuthorAuthority/entries")
.param("metadata", "dc.contributor.author") .param("metadata", "dc.contributor.author")
.param("collection", collection.getID().toString()) .param("collection", collection.getID().toString())
.param("query", "Smith") .param("filter", "Smith")
.param("size", "1000")) .param("size", "1000"))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(jsonPath("$.page.totalElements", Matchers.is(0))); .andExpect(jsonPath("$.page.totalElements", Matchers.is(0)));
@@ -379,17 +379,4 @@ public class VocabularyRestRepositoryIT extends AbstractControllerIntegrationTes
.param("metadata", "dc.type")) .param("metadata", "dc.type"))
.andExpect(status().isUnprocessableEntity()); .andExpect(status().isUnprocessableEntity());
} }
@Test
public void discoverableNestedLinkTest() throws Exception {
String token = getAuthToken(eperson.getEmail(), password);
getClient(token).perform(get("/api"))
.andExpect(status().isOk())
.andExpect(jsonPath("$._links",Matchers.allOf(
hasJsonPath("$.authorizations.href",
is("http://localhost/api/authz/authorizations")),
hasJsonPath("$.authorization-search.href",
is("http://localhost/api/authz/authorization/search"))
)));
}
} }