use of no.nav.common.auth.context.AuthContext in project veilarbportefolje by navikt.
the class EnhetControllerTest method skal_ikke_hente_noe_hvis_mangler_tilgang.
@Test(expected = ResponseStatusException.class)
public void skal_ikke_hente_noe_hvis_mangler_tilgang() {
when(modiaPep.harVeilederTilgangTilModia(any())).thenReturn(false);
authContextHolder.withContext(new AuthContext(UserRole.INTERN, generateMockJWT()), () -> enhetController.hentPortefoljeForEnhet("0001", null, 20, "ikke_satt", "ikke_satt", new Filtervalg()));
}
use of no.nav.common.auth.context.AuthContext in project veilarbportefolje by navikt.
the class EnhetControllerTest method skal_hent_portefolje_fra_indeks_dersom_tilgang.
@Test
@SneakyThrows
public void skal_hent_portefolje_fra_indeks_dersom_tilgang() {
when(modiaPep.harVeilederTilgangTilModia(anyString())).thenReturn(true);
when(pep.harVeilederTilgangTilEnhet(any(NavIdent.class), any(EnhetId.class))).thenReturn(true);
when(opensearchService.hentBrukere(any(), any(), any(), any(), any(), any(), any())).thenReturn(new BrukereMedAntall(0, Collections.emptyList()));
authContextHolder.withContext(new AuthContext(UserRole.INTERN, generateMockJWT()), () -> enhetController.hentPortefoljeForEnhet("0001", 0, 0, "ikke_satt", "ikke_satt", new Filtervalg()));
verify(opensearchService, times(1)).hentBrukere(any(), any(), any(), any(), any(), any(), any());
}
use of no.nav.common.auth.context.AuthContext in project veilarbportefolje by navikt.
the class EnhetControllerTest method skal_hente_hele_portefolje_fra_indeks_dersom_man_mangle_fra.
@Test
public void skal_hente_hele_portefolje_fra_indeks_dersom_man_mangle_fra() {
when(pep.harVeilederTilgangTilEnhet(any(), any())).thenReturn(true);
when(modiaPep.harVeilederTilgangTilModia(any())).thenReturn(true);
when(opensearchService.hentBrukere(any(), any(), any(), any(), any(), any(), any())).thenReturn(new BrukereMedAntall(0, Collections.emptyList()));
authContextHolder.withContext(new AuthContext(UserRole.INTERN, generateMockJWT()), () -> enhetController.hentPortefoljeForEnhet("0001", null, 20, "ikke_satt", "ikke_satt", new Filtervalg()));
verify(opensearchService, times(1)).hentBrukere(any(), any(), any(), any(), any(), isNull(), any());
}
use of no.nav.common.auth.context.AuthContext in project veilarbportefolje by navikt.
the class EnhetControllerTest method skal_hente_hele_portefolje_fra_indeks_dersom_man_mangle_antall.
@Test
public void skal_hente_hele_portefolje_fra_indeks_dersom_man_mangle_antall() {
when(pep.harVeilederTilgangTilEnhet(any(), any())).thenReturn(true);
when(modiaPep.harVeilederTilgangTilModia(any())).thenReturn(true);
when(opensearchService.hentBrukere(any(), any(), any(), any(), any(), any(), any())).thenReturn(new BrukereMedAntall(0, Collections.emptyList()));
authContextHolder.withContext(new AuthContext(UserRole.INTERN, generateMockJWT()), () -> enhetController.hentPortefoljeForEnhet("0001", 0, null, "ikke_satt", "ikke_satt", new Filtervalg()));
verify(opensearchService, times(1)).hentBrukere(any(), any(), any(), any(), any(), any(), any());
}
Aggregations