mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-19 07:53:08 +00:00
All multipart/form-data ITs should use multipart(), not post() or fileUpload()
This commit is contained in:
@@ -9,7 +9,7 @@ package org.dspace.curate;
|
||||
|
||||
import static com.jayway.jsonpath.JsonPath.read;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.multipart;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
|
||||
@@ -87,9 +87,8 @@ public class CurationScriptIT extends AbstractControllerIntegrationTest {
|
||||
|
||||
// Request with -t <invalidTaskOption>
|
||||
getClient(token)
|
||||
.perform(post(CURATE_SCRIPT_ENDPOINT).contentType("multipart/form-data")
|
||||
.param("properties",
|
||||
new Gson().toJson(list)))
|
||||
.perform(multipart(CURATE_SCRIPT_ENDPOINT)
|
||||
.param("properties", new Gson().toJson(list)))
|
||||
// Illegal Argument Exception
|
||||
.andExpect(status().isBadRequest());
|
||||
}
|
||||
@@ -109,9 +108,8 @@ public class CurationScriptIT extends AbstractControllerIntegrationTest {
|
||||
|
||||
// Request with missing required -i <handle>
|
||||
getClient(token)
|
||||
.perform(post(CURATE_SCRIPT_ENDPOINT).contentType("multipart/form-data")
|
||||
.param("properties",
|
||||
new Gson().toJson(list)))
|
||||
.perform(multipart(CURATE_SCRIPT_ENDPOINT)
|
||||
.param("properties", new Gson().toJson(list)))
|
||||
// Illegal Argument Exception
|
||||
.andExpect(status().isBadRequest());
|
||||
}
|
||||
@@ -132,9 +130,8 @@ public class CurationScriptIT extends AbstractControllerIntegrationTest {
|
||||
|
||||
// Request with missing required -i <handle>
|
||||
getClient(token)
|
||||
.perform(post(CURATE_SCRIPT_ENDPOINT).contentType("multipart/form-data")
|
||||
.param("properties",
|
||||
new Gson().toJson(list)))
|
||||
.perform(multipart(CURATE_SCRIPT_ENDPOINT)
|
||||
.param("properties", new Gson().toJson(list)))
|
||||
// Illegal Argument Exception
|
||||
.andExpect(status().isBadRequest());
|
||||
}
|
||||
@@ -173,9 +170,8 @@ public class CurationScriptIT extends AbstractControllerIntegrationTest {
|
||||
|
||||
// Request without -t <task> or -T <taskFile> (and no -q <queue>)
|
||||
getClient(token)
|
||||
.perform(post(CURATE_SCRIPT_ENDPOINT).contentType("multipart/form-data")
|
||||
.param("properties",
|
||||
new Gson().toJson(list)))
|
||||
.perform(multipart(CURATE_SCRIPT_ENDPOINT)
|
||||
.param("properties", new Gson().toJson(list)))
|
||||
// Illegal Argument Exception
|
||||
.andExpect(status().isBadRequest());
|
||||
}
|
||||
@@ -196,9 +192,8 @@ public class CurationScriptIT extends AbstractControllerIntegrationTest {
|
||||
|
||||
// Request with invalid -s <scope>; must be object, curation or open
|
||||
getClient(token)
|
||||
.perform(post(CURATE_SCRIPT_ENDPOINT).contentType("multipart/form-data")
|
||||
.param("properties",
|
||||
new Gson().toJson(list)))
|
||||
.perform(multipart(CURATE_SCRIPT_ENDPOINT)
|
||||
.param("properties", new Gson().toJson(list)))
|
||||
// Illegal Argument Exception
|
||||
.andExpect(status().isBadRequest());
|
||||
}
|
||||
@@ -219,9 +214,8 @@ public class CurationScriptIT extends AbstractControllerIntegrationTest {
|
||||
|
||||
// Request with invalid -s <scope>; must be object, curation or open
|
||||
getClient(token)
|
||||
.perform(post(CURATE_SCRIPT_ENDPOINT).contentType("multipart/form-data")
|
||||
.param("properties",
|
||||
new Gson().toJson(list)))
|
||||
.perform(multipart(CURATE_SCRIPT_ENDPOINT)
|
||||
.param("properties", new Gson().toJson(list)))
|
||||
// Illegal Argument Exception
|
||||
.andExpect(status().isBadRequest());
|
||||
}
|
||||
@@ -262,9 +256,8 @@ public class CurationScriptIT extends AbstractControllerIntegrationTest {
|
||||
|
||||
try {
|
||||
getClient(token)
|
||||
.perform(post(CURATE_SCRIPT_ENDPOINT).contentType("multipart/form-data")
|
||||
.param("properties",
|
||||
new Gson().toJson(list)))
|
||||
.perform(multipart(CURATE_SCRIPT_ENDPOINT)
|
||||
.param("properties", new Gson().toJson(list)))
|
||||
.andExpect(status().isAccepted())
|
||||
.andExpect(jsonPath("$", is(
|
||||
ProcessMatcher.matchProcess("curate",
|
||||
@@ -314,9 +307,8 @@ public class CurationScriptIT extends AbstractControllerIntegrationTest {
|
||||
|
||||
try {
|
||||
getClient(token)
|
||||
.perform(post(CURATE_SCRIPT_ENDPOINT).contentType("multipart/form-data")
|
||||
.param("properties",
|
||||
new Gson().toJson(list)))
|
||||
.perform(multipart(CURATE_SCRIPT_ENDPOINT)
|
||||
.param("properties", new Gson().toJson(list)))
|
||||
.andExpect(status().isAccepted())
|
||||
.andExpect(jsonPath("$", is(
|
||||
ProcessMatcher.matchProcess("curate",
|
||||
@@ -366,9 +358,8 @@ public class CurationScriptIT extends AbstractControllerIntegrationTest {
|
||||
try {
|
||||
|
||||
getClient(token)
|
||||
.perform(post(CURATE_SCRIPT_ENDPOINT).contentType("multipart/form-data")
|
||||
.param("properties",
|
||||
new Gson().toJson(list)))
|
||||
.perform(multipart(CURATE_SCRIPT_ENDPOINT)
|
||||
.param("properties", new Gson().toJson(list)))
|
||||
.andExpect(jsonPath("$", is(
|
||||
ProcessMatcher.matchProcess("curate",
|
||||
String.valueOf(admin.getID()), parameters,
|
||||
|
Reference in New Issue
Block a user