TSK-560: Changed http status code for successfully deleting a task to 204
This commit is contained in:
parent
3230e35c2c
commit
65dbb8c82c
|
@ -354,7 +354,7 @@ public class TaskControllerRestDocumentation {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.delete("http://127.0.0.1:" + port + "/v1/tasks/" + newId)
|
.delete("http://127.0.0.1:" + port + "/v1/tasks/" + newId)
|
||||||
.header("Authorization", "Basic YWRtaW46YWRtaW4=")) //admin
|
.header("Authorization", "Basic YWRtaW46YWRtaW4=")) //admin
|
||||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
.andExpect(MockMvcResultMatchers.status().isNoContent())
|
||||||
.andDo(MockMvcRestDocumentation.document("DeleteTaskDocTest"));
|
.andDo(MockMvcRestDocumentation.document("DeleteTaskDocTest"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,7 +386,7 @@ public class TaskControllerRestDocumentation {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.delete("http://127.0.0.1:" + port + "/v1/tasks/" + newId)
|
.delete("http://127.0.0.1:" + port + "/v1/tasks/" + newId)
|
||||||
.header("Authorization", "Basic YWRtaW46YWRtaW4=")) //admin
|
.header("Authorization", "Basic YWRtaW46YWRtaW4=")) //admin
|
||||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
.andExpect(MockMvcResultMatchers.status().isNoContent())
|
||||||
.andDo(MockMvcRestDocumentation.document("DeleteTaskDocTest"));
|
.andDo(MockMvcRestDocumentation.document("DeleteTaskDocTest"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -417,7 +417,7 @@ public class TaskControllerRestDocumentation {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.delete("http://127.0.0.1:" + port + "/v1/tasks/" + newId)
|
.delete("http://127.0.0.1:" + port + "/v1/tasks/" + newId)
|
||||||
.header("Authorization", "Basic YWRtaW46YWRtaW4=")) //admin
|
.header("Authorization", "Basic YWRtaW46YWRtaW4=")) //admin
|
||||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
.andExpect(MockMvcResultMatchers.status().isNoContent())
|
||||||
.andDo(MockMvcRestDocumentation.document("DeleteTaskDocTest"));
|
.andDo(MockMvcRestDocumentation.document("DeleteTaskDocTest"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -447,6 +447,6 @@ public class TaskControllerRestDocumentation {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.delete("http://127.0.0.1:" + port + "/v1/tasks/" + newId)
|
.delete("http://127.0.0.1:" + port + "/v1/tasks/" + newId)
|
||||||
.header("Authorization", "Basic YWRtaW46YWRtaW4=")) //admin
|
.header("Authorization", "Basic YWRtaW46YWRtaW4=")) //admin
|
||||||
.andExpect(MockMvcResultMatchers.status().isOk());
|
.andExpect(MockMvcResultMatchers.status().isNoContent());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -353,7 +353,7 @@ public class TaskControllerIntTest {
|
||||||
con = (HttpURLConnection) url.openConnection();
|
con = (HttpURLConnection) url.openConnection();
|
||||||
con.setRequestMethod("DELETE");
|
con.setRequestMethod("DELETE");
|
||||||
con.setRequestProperty("Authorization", "Basic YWRtaW46YWRtaW4="); // admin
|
con.setRequestProperty("Authorization", "Basic YWRtaW46YWRtaW4="); // admin
|
||||||
assertEquals(200, con.getResponseCode());
|
assertEquals(204, con.getResponseCode());
|
||||||
con.disconnect();
|
con.disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -163,7 +163,7 @@ public class TaskController extends AbstractPagingController {
|
||||||
public ResponseEntity<TaskResource> deleteTask(@PathVariable String taskId)
|
public ResponseEntity<TaskResource> deleteTask(@PathVariable String taskId)
|
||||||
throws TaskNotFoundException, InvalidStateException, NotAuthorizedException {
|
throws TaskNotFoundException, InvalidStateException, NotAuthorizedException {
|
||||||
taskService.forceDeleteTask(taskId);
|
taskService.forceDeleteTask(taskId);
|
||||||
ResponseEntity<TaskResource> result = new ResponseEntity<>(HttpStatus.OK);
|
ResponseEntity<TaskResource> result = new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue