added tests to prove right functionalicy of root search end points

This commit is contained in:
Mykhaylo
2021-03-09 17:33:18 +01:00
parent 65c84f0554
commit e6576e07cd
4 changed files with 84 additions and 0 deletions

View File

@@ -2574,4 +2574,24 @@ public class ResourcePolicyRestRepositoryIT extends AbstractControllerIntegratio
.andExpect(jsonPath("$.page.totalPages", is(4)))
.andExpect(jsonPath("$.page.totalElements", is(4)));
}
@Test
public void resourcepolicySerchMethodWithSingleModelTest() throws Exception {
String tokenAdmin = getAuthToken(admin.getEmail(), password);
getClient(tokenAdmin).perform(get("/api/authz/resourcepolicy/search"))
.andExpect(status().isNotFound());
}
@Test
public void resourcepolicySerchMethodWithPluralModelTest() throws Exception {
String tokenAdmin = getAuthToken(admin.getEmail(), password);
getClient(tokenAdmin).perform(get("/api/authz/resourcepolicies/search"))
.andExpect(status().isOk())
.andExpect(jsonPath("$._links.eperson.href", Matchers.allOf(
Matchers.containsString("/api/authz/resourcepolicies/search/eperson"))))
.andExpect(jsonPath("$._links.group.href", Matchers.allOf(
Matchers.containsString("/api/authz/resourcepolicies/search/group"))))
.andExpect(jsonPath("$._links.resource.href", Matchers.allOf(
Matchers.containsString("/api/authz/resourcepolicies/search/resource"))));
}
}

View File

@@ -14,6 +14,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
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;
/**
@@ -96,4 +97,20 @@ public class SubmissionCCLicenseUrlRepositoryIT extends AbstractControllerIntegr
.andExpect(status().isUnauthorized());
}
@Test
public void submissionCCLicenseUrlSerchMethodWithSingleModelTest() throws Exception {
String tokenAdmin = getAuthToken(admin.getEmail(), password);
getClient(tokenAdmin).perform(get("/api/config/submissioncclicenseUrl/search"))
.andExpect(status().isNotFound());
}
@Test
public void submissionCCLicenseUrlSerchMethodWithPluralModelTest() throws Exception {
String tokenAdmin = getAuthToken(admin.getEmail(), password);
getClient(tokenAdmin).perform(get("/api/config/submissioncclicenseUrls/search"))
.andExpect(status().isOk())
.andExpect(jsonPath("$._links.rightsByQuestions.href", Matchers.allOf(Matchers
.containsString("/api/config/submissioncclicenseUrls/search/rightsByQuestions"))));
}
}

View File

@@ -3092,4 +3092,36 @@ public class TaskRestRepositoriesIT extends AbstractControllerIntegrationTest {
bibtex.close();
}
@Test
public void poolTaskSerchMethodWithSingleModelTest() throws Exception {
String tokenAdmin = getAuthToken(admin.getEmail(), password);
getClient(tokenAdmin).perform(get("/api/workflow/pooltask/search"))
.andExpect(status().isNotFound());
}
@Test
public void claimedtaskSerchMethodWithSingleModelTest() throws Exception {
String tokenAdmin = getAuthToken(admin.getEmail(), password);
getClient(tokenAdmin).perform(get("/api/workflow/claimedtask/search"))
.andExpect(status().isNotFound());
}
@Test
public void poolTaskSerchMethodWithPluralModelTest() throws Exception {
String tokenAdmin = getAuthToken(admin.getEmail(), password);
getClient(tokenAdmin).perform(get("/api/workflow/pooltasks/search"))
.andExpect(status().isOk())
.andExpect(jsonPath("$._links.findByUser.href", Matchers.allOf(
Matchers.containsString("/api/workflow/pooltasks/search/findByUser"))));
}
@Test
public void claimedtaskSerchMethodWithPluralModelTest() throws Exception {
String tokenAdmin = getAuthToken(admin.getEmail(), password);
getClient(tokenAdmin).perform(get("/api/workflow/claimedtasks/search"))
.andExpect(status().isOk())
.andExpect(jsonPath("$._links.findByUser.href", Matchers.allOf(
Matchers.containsString("/api/workflow/claimedtasks/search/findByUser"))));
}
}

View File

@@ -439,4 +439,19 @@ public class VocabularyEntryDetailsIT extends AbstractControllerIntegrationTest
);
}
@Test
public void vocabularyEntryDetailSerchMethodWithSingleModelTest() throws Exception {
String tokenAdmin = getAuthToken(admin.getEmail(), password);
getClient(tokenAdmin).perform(get("/api/submission/vocabularyEntryDetail/search"))
.andExpect(status().isNotFound());
}
@Test
public void vocabularyEntryDetailSerchMethodWithPluralModelTest() throws Exception {
String tokenAdmin = getAuthToken(admin.getEmail(), password);
getClient(tokenAdmin).perform(get("/api/submission/vocabularyEntryDetails/search"))
.andExpect(status().isOk())
.andExpect(jsonPath("$._links.top.href", Matchers.allOf(
Matchers.containsString("/api/submission/vocabularyEntryDetails/search/top"))));
}
}