use of edu.hawaii.its.groupings.controller.WithMockUhUser in project uhgroupings by uhawaii-system-its-ti-iam.
the class GroupingsRestControllerTest method disableSyncDestTest.
@Test
@WithMockUhUser
public void disableSyncDestTest() throws Exception {
String uri = REST_CONTROLLER_BASE + "groupings/" + GROUPING + "/syncDests/listserv/disable";
given(httpRequestService.makeApiRequest(eq(USERNAME), anyString(), eq(HttpMethod.PUT))).willReturn(new ResponseEntity(HttpStatus.OK));
assertNotNull(mockMvc.perform(post(uri).with(csrf())).andExpect(status().isOk()).andReturn());
verify(httpRequestService, times(1)).makeApiRequest(eq(USERNAME), anyString(), eq(HttpMethod.PUT));
}
use of edu.hawaii.its.groupings.controller.WithMockUhUser in project uhgroupings by uhawaii-system-its-ti-iam.
the class GroupingsRestControllerTest method removeOwnershipsTest.
@Test
@WithMockUhUser
public void removeOwnershipsTest() throws Exception {
String uri = REST_CONTROLLER_BASE + GROUPING + "/user/removeOwnerships";
given(httpRequestService.makeApiRequest(eq(USERNAME), anyString(), eq(HttpMethod.DELETE))).willReturn(new ResponseEntity<>(HttpStatus.OK));
assertNotNull(mockMvc.perform(post(uri).with(csrf())).andExpect(status().isOk()).andReturn());
verify(httpRequestService, times(1)).makeApiRequest(eq(USERNAME), anyString(), eq(HttpMethod.DELETE));
}
use of edu.hawaii.its.groupings.controller.WithMockUhUser in project uhgroupings by uhawaii-system-its-ti-iam.
the class GroupingsRestControllerTest method updateDescriptionTest.
@Test
@WithMockUhUser
public void updateDescriptionTest() throws Exception {
String uri = REST_CONTROLLER_BASE + "groupings/path/description";
given(httpRequestService.makeApiRequestWithBody(eq(USERNAME), anyString(), eq(null), eq(HttpMethod.PUT))).willReturn(new ResponseEntity(HttpStatus.OK));
assertNotNull(mockMvc.perform(put(uri).with(csrf())).andExpect(status().isOk()).andReturn());
verify(httpRequestService, times(1)).makeApiRequestWithBody(eq(USERNAME), anyString(), eq(null), eq(HttpMethod.PUT));
}
use of edu.hawaii.its.groupings.controller.WithMockUhUser in project uhgroupings by uhawaii-system-its-ti-iam.
the class GroupingsRestControllerTest method setOptOut.
@Test
@WithMockUhUser
public void setOptOut() throws Exception {
String uri = REST_CONTROLLER_BASE + GROUPING + "/true/setOptOut";
given(httpRequestService.makeApiRequest(eq(USERNAME), anyString(), eq(HttpMethod.PUT))).willReturn(new ResponseEntity(HttpStatus.OK));
assertNotNull(mockMvc.perform(post(uri).with(csrf())).andExpect(status().isOk()).andReturn());
verify(httpRequestService, times(1)).makeApiRequest(eq(USERNAME), anyString(), eq(HttpMethod.PUT));
}
use of edu.hawaii.its.groupings.controller.WithMockUhUser in project uhgroupings by uhawaii-system-its-ti-iam.
the class GroupingsRestControllerTest method resetGroupTest.
@Test
@WithMockUhUser(username = "admin")
public void resetGroupTest() throws Exception {
String uri = REST_CONTROLLER_BASE + GROUPING + "/user1/user2" + "/resetGroup";
given(httpRequestService.makeApiRequest(eq(ADMIN_USERNAME), anyString(), eq(HttpMethod.DELETE))).willReturn(new ResponseEntity(HttpStatus.OK));
assertNotNull(mockMvc.perform(post(uri).with(csrf())).andExpect(status().isOk()).andReturn());
verify(httpRequestService, times(1)).makeApiRequest(eq(ADMIN_USERNAME), anyString(), eq(HttpMethod.DELETE));
}
Aggregations