Skip to content
Snippets Groups Projects
Commit 8efd1cf9 authored by Henry Page's avatar Henry Page :speech_balloon:
Browse files

Augment test suite

parent b083a173
No related branches found
No related tags found
2 merge requests!724Deploy,!623Resolve Amount of requests per TA In a single lab + the time taken since the last lab.
...@@ -29,7 +29,6 @@ import nl.tudelft.labracore.api.dto.*; ...@@ -29,7 +29,6 @@ import nl.tudelft.labracore.api.dto.*;
import nl.tudelft.labracore.lib.security.user.Person; import nl.tudelft.labracore.lib.security.user.Person;
import nl.tudelft.queue.cache.EditionRolesCacheManager; import nl.tudelft.queue.cache.EditionRolesCacheManager;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -41,9 +40,6 @@ public class RoleDTOService { ...@@ -41,9 +40,6 @@ public class RoleDTOService {
@Autowired @Autowired
private RoleControllerApi rApi; private RoleControllerApi rApi;
@Autowired
private ModelMapper mapper;
public List<String> names(List<PersonSummaryDTO> people) { public List<String> names(List<PersonSummaryDTO> people) {
return people.stream().map(PersonSummaryDTO::getDisplayName).collect(Collectors.toList()); return people.stream().map(PersonSummaryDTO::getDisplayName).collect(Collectors.toList());
} }
...@@ -149,9 +145,8 @@ public class RoleDTOService { ...@@ -149,9 +145,8 @@ public class RoleDTOService {
public boolean isStaff(RoleDetailsDTO role) { public boolean isStaff(RoleDetailsDTO role) {
var type = role.getType(); var type = role.getType();
return type.equals(RoleDetailsDTO.TypeEnum.TA) || type.equals(RoleDetailsDTO.TypeEnum.HEAD_TA) return Set.of(RoleDetailsDTO.TypeEnum.TA, RoleDetailsDTO.TypeEnum.HEAD_TA,
|| type.equals(RoleDetailsDTO.TypeEnum.TEACHER) RoleDetailsDTO.TypeEnum.TEACHER, RoleDetailsDTO.TypeEnum.TEACHER_RO).contains(type);
|| type.equals(RoleDetailsDTO.TypeEnum.TEACHER_RO);
} }
public boolean isStaff(RolePersonDetailsDTO role) { public boolean isStaff(RolePersonDetailsDTO role) {
......
...@@ -24,6 +24,7 @@ import java.util.Set; ...@@ -24,6 +24,7 @@ import java.util.Set;
import javax.transaction.Transactional; import javax.transaction.Transactional;
import nl.tudelft.labracore.api.dto.EditionDetailsDTO;
import nl.tudelft.queue.model.LabRequest; import nl.tudelft.queue.model.LabRequest;
import nl.tudelft.queue.model.labs.RegularLab; import nl.tudelft.queue.model.labs.RegularLab;
...@@ -51,6 +52,10 @@ class LabStatusServiceTest { ...@@ -51,6 +52,10 @@ class LabStatusServiceTest {
RegularLab oopNowRegularLab1; RegularLab oopNowRegularLab1;
RegularLab rlOopNowSharedLab;
EditionDetailsDTO oopNow;
LabRequest[] oopNowRegularLab1Requests; LabRequest[] oopNowRegularLab1Requests;
@BeforeEach @BeforeEach
...@@ -59,6 +64,8 @@ class LabStatusServiceTest { ...@@ -59,6 +64,8 @@ class LabStatusServiceTest {
oopNowRegularLab1 = db.getOopNowRegularLab1(); oopNowRegularLab1 = db.getOopNowRegularLab1();
oopNowRegularLab1Requests = db.getOopNowRegularLab1Requests(); oopNowRegularLab1Requests = db.getOopNowRegularLab1Requests();
rlOopNowSharedLab = db.getRlOopNowSharedLab();
oopNow = db.getOopNow();
} }
...@@ -67,7 +74,7 @@ class LabStatusServiceTest { ...@@ -67,7 +74,7 @@ class LabStatusServiceTest {
var result = sessionStatusService.getTimeSinceLastRequestTA(oopNowRegularLab1, new HashSet<>()); var result = sessionStatusService.getTimeSinceLastRequestTA(oopNowRegularLab1, new HashSet<>());
assertThat(result).hasSize(db.getOopNowHeadTAs().length + db.getOopNowTAs().length + 1); // 1 for teacher assertThat(result).hasSize(db.getOopNowHeadTAs().length + db.getOopNowTAs().length + 1); // 1 for teacher
assertThat(result.get("Student 211")).isEqualTo(Pair.of(-1L, "N/A")); assertThat(result.get("Student 211")).isEqualTo(Pair.of(0L, "N/A"));
assertThat(result.get("Student 200").getKey()).isGreaterThan(0L).isLessThan(10L); assertThat(result.get("Student 200").getKey()).isGreaterThan(0L).isLessThan(10L);
assertThat(result.get("Student 200").getValue()).isNotEqualTo("N/A"); assertThat(result.get("Student 200").getValue()).isNotEqualTo("N/A");
} }
...@@ -79,4 +86,11 @@ class LabStatusServiceTest { ...@@ -79,4 +86,11 @@ class LabStatusServiceTest {
assertThat(result).isEmpty(); assertThat(result).isEmpty();
} }
@Test
void filterYieldsOnlyRespectiveCourseStaff() throws Exception {
var result = sessionStatusService.getTimeSinceLastRequestTA(rlOopNowSharedLab,
Set.of(oopNow.getId()));
assertThat(result).hasSize(db.getOopNowHeadTAs().length + db.getOopNowTAs().length + 1);
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment