Search in sources :

Example 6 with Team

use of de.tum.in.www1.artemis.domain.Team in project ArTEMiS by ls1intum.

the class LearningGoalIntegrationTest method getLearningGoalCourseProgressIndividualTest_asInstructorOne.

@Test
@WithMockUser(username = "instructor1", roles = "INSTRUCTOR")
public void getLearningGoalCourseProgressIndividualTest_asInstructorOne() throws Exception {
    cleanUpInitialParticipations();
    User student1 = userRepository.findOneByLogin("student1").get();
    User student2 = userRepository.findOneByLogin("student2").get();
    User student3 = userRepository.findOneByLogin("student3").get();
    User student4 = userRepository.findOneByLogin("student4").get();
    User instructor1 = userRepository.findOneByLogin("instructor1").get();
    // will be ignored in favor of last submission from team
    createParticipationSubmissionAndResult(idOfTextExercise, student1, 10.0, 0.0, 100, true);
    createParticipationSubmissionAndResult(idOfTextExercise, student1, 10.0, 0.0, 50, false);
    // will be ignored in favor of last submission from student
    createParticipationSubmissionAndResult(idOfTextExercise, student2, 10.0, 0.0, 100, true);
    createParticipationSubmissionAndResult(idOfTextExercise, student2, 10.0, 0.0, 10, false);
    createParticipationSubmissionAndResult(idOfTextExercise, student3, 10.0, 0.0, 10, true);
    createParticipationSubmissionAndResult(idOfTextExercise, student4, 10.0, 0.0, 50, true);
    // will be ignored as not a student
    createParticipationSubmissionAndResult(idOfTextExercise, instructor1, 10.0, 0.0, 100, true);
    CourseLearningGoalProgress courseLearningGoalProgress = request.get("/api/courses/" + idOfCourse + "/goals/" + idOfLearningGoal + "/course-progress", HttpStatus.OK, CourseLearningGoalProgress.class);
    assertThat(courseLearningGoalProgress.totalPointsAchievableByStudentsInLearningGoal).isEqualTo(30.0);
    assertThat(courseLearningGoalProgress.averagePointsAchievedByStudentInLearningGoal).isEqualTo(3.0);
    assertThatSpecificCourseLectureUnitProgressExists(courseLearningGoalProgress, 20.0, 4, 30.0);
}
Also used : WithMockUser(org.springframework.security.test.context.support.WithMockUser) CourseLearningGoalProgress(de.tum.in.www1.artemis.web.rest.dto.CourseLearningGoalProgress) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.jupiter.api.Test)

Example 7 with Team

use of de.tum.in.www1.artemis.domain.Team in project ArTEMiS by ls1intum.

the class TeamImportIntegrationTest method testImportTeamsIntoExerciseWithTeamShortNameConflictsUsingCreateOnlyStrategy.

private void testImportTeamsIntoExerciseWithTeamShortNameConflictsUsingCreateOnlyStrategy(ImportType type, List<Team> body, List<Team> teamsWithoutConflict) throws Exception {
    TeamImportStrategyType strategyType = TeamImportStrategyType.CREATE_ONLY;
    List<Team> destinationTeamsBefore = database.addTeamsForExercise(destinationExercise, "sameShortName", 3, tutor);
    // destination teams before + conflict-free source teams = destination teams after
    testImportTeamsIntoExercise(type, strategyType, body, addLists(destinationTeamsBefore, teamsWithoutConflict));
}
Also used : TeamImportStrategyType(de.tum.in.www1.artemis.domain.enumeration.TeamImportStrategyType)

Example 8 with Team

use of de.tum.in.www1.artemis.domain.Team in project ArTEMiS by ls1intum.

the class TeamImportIntegrationTest method testImportTeamsIntoExerciseWithNoConflictsUsingCreateOnlyStrategy.

private void testImportTeamsIntoExerciseWithNoConflictsUsingCreateOnlyStrategy(ImportType type, List<Team> body, List<Team> addedTeams) throws Exception {
    TeamImportStrategyType strategyType = TeamImportStrategyType.CREATE_ONLY;
    List<Team> destinationTeamsBefore = database.addTeamsForExercise(destinationExercise, 1, tutor);
    // destination teams before + source teams = destination teams after
    testImportTeamsIntoExercise(type, strategyType, body, addLists(destinationTeamsBefore, addedTeams));
}
Also used : TeamImportStrategyType(de.tum.in.www1.artemis.domain.enumeration.TeamImportStrategyType)

Example 9 with Team

use of de.tum.in.www1.artemis.domain.Team in project ArTEMiS by ls1intum.

the class TeamImportIntegrationTest method testImportTeamsIntoExerciseWithConflictsUsingPurgeExistingStrategy.

private void testImportTeamsIntoExerciseWithConflictsUsingPurgeExistingStrategy(ImportType type, List<Team> body, List<Team> addedTeams) throws Exception {
    TeamImportStrategyType strategyType = TeamImportStrategyType.PURGE_EXISTING;
    database.addTeamsForExercise(destinationExercise, "sameShortName", 2, tutor);
    // imported source teams = destination teams after
    testImportTeamsIntoExercise(type, strategyType, body, addedTeams);
}
Also used : TeamImportStrategyType(de.tum.in.www1.artemis.domain.enumeration.TeamImportStrategyType)

Example 10 with Team

use of de.tum.in.www1.artemis.domain.Team in project ArTEMiS by ls1intum.

the class TeamImportIntegrationTest method testImportTeamsIntoExerciseWithNoConflictsUsingPurgeExistingStrategy.

private void testImportTeamsIntoExerciseWithNoConflictsUsingPurgeExistingStrategy(ImportType type, List<Team> body, List<Team> addedTeams) throws Exception {
    TeamImportStrategyType strategyType = TeamImportStrategyType.PURGE_EXISTING;
    database.addTeamsForExercise(destinationExercise, 4, tutor);
    testImportTeamsIntoExercise(type, strategyType, body, addedTeams);
}
Also used : TeamImportStrategyType(de.tum.in.www1.artemis.domain.enumeration.TeamImportStrategyType)

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