use of de.tum.in.www1.artemis.service.dto.TeamSearchUserDTO in project Artemis by ls1intum.
the class TeamIntegrationTest method testSearchUsersInCourse.
@Test
@WithMockUser(username = "tutor1", roles = "TA")
public void testSearchUsersInCourse() throws Exception {
// Check that all students from course are found (since their logins are all prefixed by "student")
List<TeamSearchUserDTO> users1 = request.getList(resourceUrlSearchUsersInCourse("student"), HttpStatus.OK, TeamSearchUserDTO.class);
assertThat(users1).as("All users of course with 'student' in login were found").hasSize(numberOfStudentsInCourse);
// Check that a student is found by his login and that he is NOT marked as "assignedToTeam" yet
List<TeamSearchUserDTO> users2 = request.getList(resourceUrlSearchUsersInCourse("student1"), HttpStatus.OK, TeamSearchUserDTO.class);
assertThat(users2).as("Only user with login 'student1' was found").hasSize(1);
assertThat(users2.get(0).getAssignedTeamId()).as("User was correctly marked as not being assigned to a team yet").isNull();
// Check that no student is returned for non-existing login/name
List<TeamSearchUserDTO> users3 = request.getList(resourceUrlSearchUsersInCourse("chuckNorris"), HttpStatus.OK, TeamSearchUserDTO.class);
assertThat(users3).as("No user was found as expected").isEmpty();
// Check whether a student from a team is found but marked as "assignedToTeam"
Team team = database.addTeamForExercise(exercise, tutor);
User teamStudent = team.getStudents().iterator().next();
List<TeamSearchUserDTO> users4 = request.getList(resourceUrlSearchUsersInCourse(teamStudent.getLogin()), HttpStatus.OK, TeamSearchUserDTO.class);
assertThat(users4).as("User from team was found").hasSize(1);
assertThat(users4.get(0).getAssignedTeamId()).as("User from team was correctly marked as being assigned to a team already").isEqualTo(team.getId());
}
use of de.tum.in.www1.artemis.service.dto.TeamSearchUserDTO in project ArTEMiS by ls1intum.
the class TeamIntegrationTest method testSearchUsersInCourse.
@Test
@WithMockUser(username = "tutor1", roles = "TA")
public void testSearchUsersInCourse() throws Exception {
// Check that all students from course are found (since their logins are all prefixed by "student")
List<TeamSearchUserDTO> users1 = request.getList(resourceUrlSearchUsersInCourse("student"), HttpStatus.OK, TeamSearchUserDTO.class);
assertThat(users1).as("All users of course with 'student' in login were found").hasSize(numberOfStudentsInCourse);
// Check that a student is found by his login and that he is NOT marked as "assignedToTeam" yet
List<TeamSearchUserDTO> users2 = request.getList(resourceUrlSearchUsersInCourse("student1"), HttpStatus.OK, TeamSearchUserDTO.class);
assertThat(users2).as("Only user with login 'student1' was found").hasSize(1);
assertThat(users2.get(0).getAssignedTeamId()).as("User was correctly marked as not being assigned to a team yet").isNull();
// Check that no student is returned for non-existing login/name
List<TeamSearchUserDTO> users3 = request.getList(resourceUrlSearchUsersInCourse("chuckNorris"), HttpStatus.OK, TeamSearchUserDTO.class);
assertThat(users3).as("No user was found as expected").isEmpty();
// Check whether a student from a team is found but marked as "assignedToTeam"
Team team = database.addTeamForExercise(exercise, tutor);
User teamStudent = team.getStudents().iterator().next();
List<TeamSearchUserDTO> users4 = request.getList(resourceUrlSearchUsersInCourse(teamStudent.getLogin()), HttpStatus.OK, TeamSearchUserDTO.class);
assertThat(users4).as("User from team was found").hasSize(1);
assertThat(users4.get(0).getAssignedTeamId()).as("User from team was correctly marked as being assigned to a team already").isEqualTo(team.getId());
}
Aggregations