From 2d28abefeaf79ed7f5b02dc3241a40a77a889542 Mon Sep 17 00:00:00 2001 From: Filip Izydorczyk Date: Mon, 18 Jan 2021 14:19:09 +0100 Subject: [PATCH] test --- .../controllers/CommisionControllerTest.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/restservice/src/test/java/com/plannaplan/controllers/CommisionControllerTest.java b/restservice/src/test/java/com/plannaplan/controllers/CommisionControllerTest.java index f09a5e1..251ebfa 100755 --- a/restservice/src/test/java/com/plannaplan/controllers/CommisionControllerTest.java +++ b/restservice/src/test/java/com/plannaplan/controllers/CommisionControllerTest.java @@ -47,6 +47,7 @@ public class CommisionControllerTest extends AbstractControllerTest { private static final String GET_COMMISIONS_ENDPOINT = "/api/v1/commisions/user"; private static final String GET_SOMEONE_COMMISIONS_ENDPOINT = "/api/v1/commisions/user"; private static final String GET_USER_SCHEDULE_ENDPOINT = "/api/v1/commisions/user/schedule"; + private static final String GET_ASSIGNMENTS_ENDPOINT = "/api/v1/commisions/user/assignments"; private static final String EXPORT_DATA = "/api/v1/commisions/export/csv"; @@ -307,4 +308,16 @@ public class CommisionControllerTest extends AbstractControllerTest { mockMvc.perform(get(EXPORT_DATA).header("Authorization", "Bearer " + token)).andExpect(status().isOk()) .andReturn().getResponse().getContentAsString().contains("user_id, zaj_cykl_id, gr_nr")); } + + @Test + public void shouldRetrunOkForAssignmentEnpoint() throws Exception { + this.checkUsers(); + final User admin = this.service.checkForUser(TEST_COMMISIONS_STUDENT_EMAIL, null); + final String token = this.service.login(admin).getToken(); + + MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).apply(springSecurity()).build(); + + mockMvc.perform(get(GET_ASSIGNMENTS_ENDPOINT).header("Authorization", "Bearer " + token)) + .andExpect(status().isOk()); + } }