From 1571bccb499881f37368479eda74735bfe53d15d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Wo=C5=BAniak?= Date: Fri, 30 Oct 2020 17:22:40 +0100 Subject: [PATCH] Changed api links in the Tests --- restservice/src/main/java/com/plannaplan/App.java | 2 +- .../plannaplan/controllers/AssignmentsControllerTest.java | 2 +- .../com/plannaplan/controllers/CommisionControllerTest.java | 4 ++-- .../com/plannaplan/controllers/CoursesControllerTest.java | 4 ++-- .../com/plannaplan/controllers/GroupControllerTest.java | 6 +++--- .../com/plannaplan/controllers/UsersControllerTest.java | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/restservice/src/main/java/com/plannaplan/App.java b/restservice/src/main/java/com/plannaplan/App.java index 6e91104..0a789c9 100755 --- a/restservice/src/main/java/com/plannaplan/App.java +++ b/restservice/src/main/java/com/plannaplan/App.java @@ -53,7 +53,7 @@ public class App { mar.setEmail("marwoz16@st.amu.edu.pl"); mar.setName("Marcin"); mar.setSurname("Woźniak"); - mar.setRole(UserRoles.STUDENT); + mar.setRole(UserRoles.ADMIN); this.userService.save(mar); } diff --git a/restservice/src/test/java/com/plannaplan/controllers/AssignmentsControllerTest.java b/restservice/src/test/java/com/plannaplan/controllers/AssignmentsControllerTest.java index 5e7e578..1af3781 100755 --- a/restservice/src/test/java/com/plannaplan/controllers/AssignmentsControllerTest.java +++ b/restservice/src/test/java/com/plannaplan/controllers/AssignmentsControllerTest.java @@ -23,7 +23,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @ContextConfiguration public class AssignmentsControllerTest { - private static final String ASSIGFNMENTS_ENDPOINT = "/api/v1/assignments/getCurrentAssignments"; + private static final String ASSIGFNMENTS_ENDPOINT = "/api/v1/assignments/user"; private static final String TEST_MAIL = "notexistingassignmentuser@mail.domain"; @Autowired diff --git a/restservice/src/test/java/com/plannaplan/controllers/CommisionControllerTest.java b/restservice/src/test/java/com/plannaplan/controllers/CommisionControllerTest.java index bf371d7..a4a1ba9 100755 --- a/restservice/src/test/java/com/plannaplan/controllers/CommisionControllerTest.java +++ b/restservice/src/test/java/com/plannaplan/controllers/CommisionControllerTest.java @@ -36,8 +36,8 @@ public class CommisionControllerTest { private static User user; - private static final String ADD_COMMISION_ENDPOINT = "/api/v1/commisions/add"; - private static final String GET_COMMISIONS_ENDPOINT = "/api/v1/commisions/getAllCommisions"; + private static final String ADD_COMMISION_ENDPOINT = "/api/v1/commisions/user"; + private static final String GET_COMMISIONS_ENDPOINT = "/api/v1/commisions/user"; private static final String TEST_COMMISIONS_EMAIL = "commisions@notexisting.domain"; private static final MediaType APPLICATION_JSON_UTF8 = new MediaType(MediaType.APPLICATION_JSON.getType(), MediaType.APPLICATION_JSON.getSubtype(), Charset.forName("utf8")); diff --git a/restservice/src/test/java/com/plannaplan/controllers/CoursesControllerTest.java b/restservice/src/test/java/com/plannaplan/controllers/CoursesControllerTest.java index 67af08f..3fa70f3 100755 --- a/restservice/src/test/java/com/plannaplan/controllers/CoursesControllerTest.java +++ b/restservice/src/test/java/com/plannaplan/controllers/CoursesControllerTest.java @@ -18,8 +18,8 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @ContextConfiguration public class CoursesControllerTest { - private static final String COURSES_ENDPOINT = "/api/v1/courses/getCourses"; - private static final String COURSESGROUPS_ENDPOINT = "/api/v1/courses/getCoursesWithGroups"; + private static final String COURSES_ENDPOINT = "/api/v1/courses/all"; + private static final String COURSESGROUPS_ENDPOINT = "/api/v1/courses/all?groups=true"; @Autowired private WebApplicationContext webApplicationContext; diff --git a/restservice/src/test/java/com/plannaplan/controllers/GroupControllerTest.java b/restservice/src/test/java/com/plannaplan/controllers/GroupControllerTest.java index 4698bdc..fef8682 100755 --- a/restservice/src/test/java/com/plannaplan/controllers/GroupControllerTest.java +++ b/restservice/src/test/java/com/plannaplan/controllers/GroupControllerTest.java @@ -17,7 +17,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @SpringBootTest @ContextConfiguration public class GroupControllerTest { - private static final String GROUPS_BY_COURSE_ENDPOINT = "/api/v1/groups/getCourseGroups"; + private static final String GROUPS_BY_COURSE_ENDPOINT = "/api/v1/groups/course"; @Autowired private WebApplicationContext webApplicationContext; @@ -25,12 +25,12 @@ public class GroupControllerTest { @Test public void shouldFailWithNoParaeter() throws Exception { MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build(); - mockMvc.perform(get(GROUPS_BY_COURSE_ENDPOINT)).andExpect(status().isBadRequest()); + mockMvc.perform(get(GROUPS_BY_COURSE_ENDPOINT)).andExpect(status().isNotFound()); } @Test public void shouldReturnGroupsOk() throws Exception { MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build(); - mockMvc.perform(get(GROUPS_BY_COURSE_ENDPOINT).param("id", "2")).andExpect(status().isOk()); + mockMvc.perform(get(GROUPS_BY_COURSE_ENDPOINT + "/2" )).andExpect(status().isOk()); } } diff --git a/restservice/src/test/java/com/plannaplan/controllers/UsersControllerTest.java b/restservice/src/test/java/com/plannaplan/controllers/UsersControllerTest.java index b55850d..d5eee16 100755 --- a/restservice/src/test/java/com/plannaplan/controllers/UsersControllerTest.java +++ b/restservice/src/test/java/com/plannaplan/controllers/UsersControllerTest.java @@ -22,7 +22,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @SpringBootTest @ContextConfiguration public class UsersControllerTest { - private static final String ENDPOINT = "/api/v1/users/searchForStudents"; + private static final String ENDPOINT = "/api/v1/users/search"; @Autowired private WebApplicationContext webApplicationContext;