Search in sources :

Example 76 with Team

use of de.tum.in.www1.artemis.domain.Team 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));
}
Also used : TeamAssignmentPayload(de.tum.in.www1.artemis.web.websocket.dto.TeamAssignmentPayload) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.jupiter.api.Test) AbstractSpringIntegrationBambooBitbucketJiraTest(de.tum.in.www1.artemis.AbstractSpringIntegrationBambooBitbucketJiraTest)

Aggregations

WithMockUser (org.springframework.security.test.context.support.WithMockUser)34 Test (org.junit.jupiter.api.Test)32 TeamImportStrategyType (de.tum.in.www1.artemis.domain.enumeration.TeamImportStrategyType)14 StudentParticipation (de.tum.in.www1.artemis.domain.participation.StudentParticipation)12 TeamAssignmentPayload (de.tum.in.www1.artemis.web.websocket.dto.TeamAssignmentPayload)12 AbstractSpringIntegrationBambooBitbucketJiraTest (de.tum.in.www1.artemis.AbstractSpringIntegrationBambooBitbucketJiraTest)10 ModelingExercise (de.tum.in.www1.artemis.domain.modeling.ModelingExercise)10 de.tum.in.www1.artemis.domain (de.tum.in.www1.artemis.domain)8 ExerciseMode (de.tum.in.www1.artemis.domain.enumeration.ExerciseMode)8 de.tum.in.www1.artemis.repository (de.tum.in.www1.artemis.repository)8 ZonedDateTime (java.time.ZonedDateTime)8 java.util (java.util)8 Collectors (java.util.stream.Collectors)8 Stream (java.util.stream.Stream)8 BeforeEach (org.junit.jupiter.api.BeforeEach)8 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)8 TeamSearchUserDTO (de.tum.in.www1.artemis.service.dto.TeamSearchUserDTO)6 ModelFactory (de.tum.in.www1.artemis.util.ModelFactory)6 CourseLearningGoalProgress (de.tum.in.www1.artemis.web.rest.dto.CourseLearningGoalProgress)6 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)6