use of edu.hawaii.its.groupings.controller.WithMockUhUser in project uhgroupings by uhawaii-system-its-ti-iam.
the class GroupingsRestControllerTest method setOptOutFalseTest.
@Test
@WithMockUhUser
public void setOptOutFalseTest() throws Exception {
String uri = REST_CONTROLLER_BASE + GROUPING + "/false/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 enableSyncDestTest.
@Test
@WithMockUhUser
public void enableSyncDestTest() throws Exception {
String uri = REST_CONTROLLER_BASE + "groupings/" + GROUPING + "/syncDests/listserv/enable";
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 optInTest.
@Test
@WithMockUhUser
public void optInTest() throws Exception {
String uri = REST_CONTROLLER_BASE + GROUPING + "/optIn";
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 currentUsernameTest.
@Test
@WithMockUhUser
public void currentUsernameTest() throws Exception {
String uri = REST_CONTROLLER_BASE + "/currentUser";
assertNotNull(mockMvc.perform(get(uri).with(csrf())).andExpect(status().isOk()).andExpect(content().json("{'username':" + USERNAME + "}")).andReturn());
}
use of edu.hawaii.its.groupings.controller.WithMockUhUser in project uhgroupings by uhawaii-system-its-ti-iam.
the class GroupingsRestControllerTest method numberOfMembershipsTest.
@Test
@WithMockUhUser
public void numberOfMembershipsTest() throws Exception {
String uri = REST_CONTROLLER_BASE + "/members/memberships";
given(httpRequestService.makeApiRequest(eq(USERNAME), anyString(), eq(HttpMethod.GET))).willReturn(new ResponseEntity(HttpStatus.OK));
assertNotNull(mockMvc.perform(get(uri).with(csrf())).andExpect(status().isOk()).andReturn());
verify(httpRequestService, times(1)).makeApiRequest(eq(USERNAME), anyString(), eq(HttpMethod.GET));
}
Aggregations