@Test public void call_permission_service_with_right_data() throws Exception { ws.newPostRequest(PermissionsWs.ENDPOINT, ACTION) .setParam(PARAM_USER_LOGIN, "ray.bradbury") .setParam(PARAM_PERMISSION, SYSTEM_ADMIN) .execute(); verify(permissionUpdater).removePermission(permissionChangeCaptor.capture()); PermissionChange permissionChange = permissionChangeCaptor.getValue(); assertThat(permissionChange.userLogin()).isEqualTo("ray.bradbury"); assertThat(permissionChange.permission()).isEqualTo(SYSTEM_ADMIN); }
@Test public void remove_with_project_uuid() throws Exception { insertComponent(newProjectDto("project-uuid").setKey("project-key")); ws.newPostRequest(PermissionsWs.ENDPOINT, ACTION) .setParam(PARAM_USER_LOGIN, "ray.bradbury") .setParam(PARAM_PROJECT_UUID, "project-uuid") .setParam(PARAM_PERMISSION, SYSTEM_ADMIN) .execute(); verify(permissionUpdater).removePermission(permissionChangeCaptor.capture()); PermissionChange permissionChange = permissionChangeCaptor.getValue(); assertThat(permissionChange.componentKey()).isEqualTo("project-key"); }