Skip to content
Snippets Groups Projects
Commit 3e88386f authored by Rūta Giedrytė's avatar Rūta Giedrytė :seedling:
Browse files

add test

parent 6ca32b79
No related branches found
No related tags found
1 merge request!421Teachers without edition can now also access TAM
Pipeline #1238614 passed
......@@ -343,6 +343,33 @@ class JobOfferControllerTest {
verify(coordinatorDefaultService).addDefaultsToEditionsWithJobsAndWork(anyList());
}
@Test
@WithUserDetails("teacher")
void getManagerPortalTeacherWithNoEditionsTest() throws Exception {
String q = "edi";
when(personService.getRolesForPerson(anyLong())).thenReturn(List.of());
when(editionService.getEditionsWithJobsAndWork(anyList())).thenReturn(List.of());
when(editionService.filter(anyList(), anyString())).thenReturn(List.of());
when(authService.isStaff()).thenReturn(true);
when(courseService.getManagingCourses(any())).thenReturn(List.of());
when(cohortService.getAllCohorts()).thenReturn(List.of());
doNothing().when(coordinatorDefaultService).addDefaultsToEditionsWithJobsAndWork(anyList());
mvc.perform(get("/job-offer/manage").param("q", q).with(csrf()))
.andExpect(status().isOk())
.andExpect(view().name("job_offer/manage"))
.andExpect(model().attribute("editions", List.of()))
.andExpect(model().attribute("managed", List.of()))
.andExpect(model().attribute("cohorts", List.of()));
verify(editionService).getAllEditionIdsThatPersonIsAMangerOf(anyLong());
verify(courseService).getManagingCourses(any());
verify(editionService).getEditionsWithJobsAndWork(List.of());
verify(editionService).filter(List.of(), q);
verify(coordinatorDefaultService).addDefaultsToEditionsWithJobsAndWork(anyList());
}
@Test
@WithUserDetails("admin")
void getManagerPortalTestWithHidePrev() throws Exception {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment