use of de.tum.in.www1.artemis.web.websocket.dto.TeamAssignmentPayload in project Artemis by ls1intum.
the class TeamWebsocketServiceTest method testSendTeamAssignmentUpdateOnRemoveStudentFromTeam.
@Test
@WithMockUser(username = "tutor1", roles = "TA")
void testSendTeamAssignmentUpdateOnRemoveStudentFromTeam() throws Exception {
Team team = new Team().name("Team").shortName("team").exercise(modelingExercise).students(students);
team = request.postWithResponseBody(teamResourceUrl(), team, Team.class, HttpStatus.CREATED);
User studentToRemoveFromTeam = students.iterator().next();
Team updatedTeam = new Team(team).id(team.getId()).removeStudents(studentToRemoveFromTeam);
request.putWithResponseBody(teamResourceUrl() + "/" + updatedTeam.getId(), updatedTeam, Team.class, HttpStatus.OK);
TeamAssignmentPayload expectedPayload = new TeamAssignmentPayload(modelingExercise, null);
verify(messagingTemplate).convertAndSendToUser(studentToRemoveFromTeam.getLogin(), assignmentTopic, expectedPayload);
}
use of de.tum.in.www1.artemis.web.websocket.dto.TeamAssignmentPayload in project Artemis by ls1intum.
the class TeamWebsocketServiceTest method testSendTeamAssignmentUpdateOnAddStudentToTeam.
@Test
@WithMockUser(username = "tutor1", roles = "TA")
void testSendTeamAssignmentUpdateOnAddStudentToTeam() throws Exception {
Team team = new Team().name("Team").shortName("team").exercise(modelingExercise);
team = request.postWithResponseBody(teamResourceUrl(), team, Team.class, HttpStatus.CREATED);
Team updatedTeam = new Team(team).id(team.getId()).students(students);
updatedTeam = request.putWithResponseBody(teamResourceUrl() + "/" + updatedTeam.getId(), updatedTeam, Team.class, HttpStatus.OK);
TeamAssignmentPayload expectedPayload = new TeamAssignmentPayload(modelingExercise, updatedTeam);
team.getStudents().forEach(user -> verify(messagingTemplate).convertAndSendToUser(user.getLogin(), assignmentTopic, expectedPayload));
}
Aggregations