use of com.enonic.xp.security.PrincipalQuery in project xp by enonic.
the class FindPrincipalsHandlerTest method testFindPrincipalsUsers.
@Test
public void testFindPrincipalsUsers() {
final PrincipalQuery expectedQuery = PrincipalQuery.create().includeUsers().idProvider(IdProviderKey.from("enonic")).from(2).size(3).build();
final PrincipalQueryResult result = PrincipalQueryResult.create().addPrincipal(TestDataFixtures.getTestUser()).totalSize(3).build();
Mockito.when(securityService.query(Mockito.eq(expectedQuery))).thenReturn(result);
runFunction("/test/findPrincipals-test.js", "findPrincipalsUsers");
}
use of com.enonic.xp.security.PrincipalQuery in project xp by enonic.
the class FindPrincipalsHandlerTest method testFindPrincipalsBySearchText.
@Test
public void testFindPrincipalsBySearchText() {
final PrincipalQuery expectedQuery = PrincipalQuery.create().searchText("enonic").build();
final PrincipalQueryResult result = PrincipalQueryResult.create().addPrincipal(TestDataFixtures.getTestUser()).totalSize(1).build();
Mockito.when(securityService.query(Mockito.eq(expectedQuery))).thenReturn(result);
runFunction("/test/findPrincipals-test.js", "findPrincipalsBySearchText");
}
use of com.enonic.xp.security.PrincipalQuery in project xp by enonic.
the class FindPrincipalsHandlerTest method testFindPrincipalsGroups.
@Test
public void testFindPrincipalsGroups() {
final PrincipalQuery expectedQuery = PrincipalQuery.create().includeGroups().idProvider(IdProviderKey.from("enonic")).from(2).size(3).build();
final PrincipalQueryResult result = PrincipalQueryResult.create().addPrincipal(TestDataFixtures.getTestGroup()).totalSize(3).build();
Mockito.when(securityService.query(Mockito.eq(expectedQuery))).thenReturn(result);
runFunction("/test/findPrincipals-test.js", "findPrincipalsGroups");
}
Aggregations