mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
Created basic IT
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
/**
|
||||
* The contents of this file are subject to the license and copyright
|
||||
* detailed in the LICENSE and NOTICE files at the root of the source
|
||||
* tree and available online at
|
||||
*
|
||||
* http://www.dspace.org/license/
|
||||
*/
|
||||
package org.dspace.app.rest;
|
||||
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
|
||||
import org.dspace.app.rest.test.AbstractControllerIntegrationTest;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.Test;
|
||||
|
||||
public class AuthorityRestRepositoryIT extends AbstractControllerIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void correctQueryTest() throws Exception {
|
||||
String token = getAuthToken(admin.getEmail(), password);
|
||||
getClient(token).perform(
|
||||
get("/api/integration/authorities/srsc/entries")
|
||||
.param("metadata", "dc.subject")
|
||||
.param("query", "Research")
|
||||
.param("size", "1000"))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.page.totalElements", Matchers.greaterThan(1)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void incorrectQueryTest() throws Exception {
|
||||
String token = getAuthToken(admin.getEmail(), password);
|
||||
getClient(token).perform(
|
||||
get("/api/integration/authorities/srsc/entries")
|
||||
.param("metadata", "dc.subject")
|
||||
.param("query", "Research2")
|
||||
.param("size", "1000"))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.page.totalElements", Matchers.is(0)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void commonTypesTest() throws Exception {
|
||||
String token = getAuthToken(admin.getEmail(), password);
|
||||
getClient(token).perform(
|
||||
get("/api/integration/authorities/common_types/entries")
|
||||
.param("metadata", "dc.type")
|
||||
.param("query", "Book")
|
||||
.param("size", "1000"))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.page.totalElements", Matchers.greaterThan(0)));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user