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.setName("Marcin");
mar.setSurname("Woźniak");
mar.setRole(UserRoles.STUDENT);
mar.setRole(UserRoles.ADMIN);
this.userService.save(mar);
}

View File

@ -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

View File

@ -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"));

View File

@ -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;

View File

@ -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());
}
}

View File

@ -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;