Skip to content
Snippets Groups Projects
Commit f95ada37 authored by Jan Pokorný's avatar Jan Pokorný :lifter_tone2:
Browse files

fixing tests

parent 3ee9f0e1
No related branches found
No related tags found
1 merge request!46LanguageSchool fixes + enrol expel rework
Pipeline #
......@@ -155,7 +155,7 @@ public class LectureController {
*/
@Operation(security = @SecurityRequirement(name = ModuleLanguageSchoolApplication.SECURITY_SCHEME_NAME, scopes = {"test_1", "test_2"}))
@ApiOperation(value = "Add student to the existing lecture")
@PatchMapping("/enrol/{id}")
@PatchMapping("/enrolStudent/{id}")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "The lecture has been successfully updated"),
@ApiResponse(code = 404, message = "The lecture with the specified ID does not exist")
......
......@@ -232,7 +232,7 @@ public class CourseControllerTest {
Mockito.when(courseFacade.enrol(ArgumentMatchers.anyLong(),
ArgumentMatchers.anyLong())).thenReturn(courseDtoWithStudent);
mockMvc.perform(patch("/courses/enrol/" + id).param("studentId", String.valueOf(1L))
mockMvc.perform(patch("/courses/enrolStudent/" + id).param("studentId", String.valueOf(1L))
.content(asJsonString(student))
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
......@@ -245,7 +245,7 @@ public class CourseControllerTest {
@WithMockUser(authorities = {"SCOPE_test_1"})
@Test
void enrolCourseWithoutUserParameter() throws Exception {
mockMvc.perform(patch("/courses/enrol/" + 0L))
mockMvc.perform(patch("/courses/enrolStudent/" + 0L))
.andExpect(status().is4xxClientError());
}
......@@ -272,7 +272,7 @@ public class CourseControllerTest {
UserDto student = new UserDto("novakovat", "novakova@gamil.com", "Tereza",
"Nováková",new HashMap<>());
mockMvc.perform(patch("/courses/expel/" + id)
mockMvc.perform(patch("/courses/expelStudent/" + id)
.param("studentId","0")
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
......@@ -286,7 +286,7 @@ public class CourseControllerTest {
@WithMockUser(authorities = {"SCOPE_test_1"})
@Test
void expelCourseWithoutUserParameter() throws Exception {
mockMvc.perform(patch("/courses/expel/" + 0L))
mockMvc.perform(patch("/courses/expelStudent/" + 0L))
.andExpect(status().is4xxClientError());
}
......
......@@ -216,7 +216,7 @@ public class LectureControllerTest {
.thenReturn(lectureDto);
UserDto student = new UserDto("novakovat", "novakova@gamil.com", "Tereza",
"Nováková",new HashMap<>());
mockMvc.perform(patch("/lectures/enrol/{id}", id)
mockMvc.perform(patch("/lectures/enrolStudent/{id}", id)
.param("studentId","0")
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
......@@ -244,7 +244,7 @@ public class LectureControllerTest {
.thenReturn(lectureDto);
UserDto student = new UserDto("novakovat", "novakova@gamil.com", "Tereza",
"Nováková",new HashMap<>());
mockMvc.perform(patch("/lectures/expel/" + id)
mockMvc.perform(patch("/lectures/expelStudent/" + id)
.param("studentId","0")
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment