Changed api links in the Tests

This commit is contained in:
Marcin Woźniak 2020-10-30 17:22:40 +01:00
parent 2b59c181e5
commit 1571bccb49
6 changed files with 10 additions and 10 deletions

View File

@ -53,7 +53,7 @@ public class App {
mar.setEmail("marwoz16@st.amu.edu.pl"); mar.setEmail("marwoz16@st.amu.edu.pl");
mar.setName("Marcin"); mar.setName("Marcin");
mar.setSurname("Woźniak"); mar.setSurname("Woźniak");
mar.setRole(UserRoles.STUDENT); mar.setRole(UserRoles.ADMIN);
this.userService.save(mar); this.userService.save(mar);
} }

View File

@ -23,7 +23,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
@ContextConfiguration @ContextConfiguration
public class AssignmentsControllerTest { 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"; private static final String TEST_MAIL = "notexistingassignmentuser@mail.domain";
@Autowired @Autowired

View File

@ -36,8 +36,8 @@ public class CommisionControllerTest {
private static User user; private static User user;
private static final String ADD_COMMISION_ENDPOINT = "/api/v1/commisions/add"; private static final String ADD_COMMISION_ENDPOINT = "/api/v1/commisions/user";
private static final String GET_COMMISIONS_ENDPOINT = "/api/v1/commisions/getAllCommisions"; private static final String GET_COMMISIONS_ENDPOINT = "/api/v1/commisions/user";
private static final String TEST_COMMISIONS_EMAIL = "commisions@notexisting.domain"; private static final String TEST_COMMISIONS_EMAIL = "commisions@notexisting.domain";
private static final MediaType APPLICATION_JSON_UTF8 = new MediaType(MediaType.APPLICATION_JSON.getType(), private static final MediaType APPLICATION_JSON_UTF8 = new MediaType(MediaType.APPLICATION_JSON.getType(),
MediaType.APPLICATION_JSON.getSubtype(), Charset.forName("utf8")); MediaType.APPLICATION_JSON.getSubtype(), Charset.forName("utf8"));

View File

@ -18,8 +18,8 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
@ContextConfiguration @ContextConfiguration
public class CoursesControllerTest { public class CoursesControllerTest {
private static final String COURSES_ENDPOINT = "/api/v1/courses/getCourses"; private static final String COURSES_ENDPOINT = "/api/v1/courses/all";
private static final String COURSESGROUPS_ENDPOINT = "/api/v1/courses/getCoursesWithGroups"; private static final String COURSESGROUPS_ENDPOINT = "/api/v1/courses/all?groups=true";
@Autowired @Autowired
private WebApplicationContext webApplicationContext; private WebApplicationContext webApplicationContext;

View File

@ -17,7 +17,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
@SpringBootTest @SpringBootTest
@ContextConfiguration @ContextConfiguration
public class GroupControllerTest { 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 @Autowired
private WebApplicationContext webApplicationContext; private WebApplicationContext webApplicationContext;
@ -25,12 +25,12 @@ public class GroupControllerTest {
@Test @Test
public void shouldFailWithNoParaeter() throws Exception { public void shouldFailWithNoParaeter() throws Exception {
MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build(); 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 @Test
public void shouldReturnGroupsOk() throws Exception { public void shouldReturnGroupsOk() throws Exception {
MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build(); 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());
} }
} }

View File

@ -22,7 +22,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
@SpringBootTest @SpringBootTest
@ContextConfiguration @ContextConfiguration
public class UsersControllerTest { public class UsersControllerTest {
private static final String ENDPOINT = "/api/v1/users/searchForStudents"; private static final String ENDPOINT = "/api/v1/users/search";
@Autowired @Autowired
private WebApplicationContext webApplicationContext; private WebApplicationContext webApplicationContext;