Search in sources :

Example 1 with UserCache

use of io.lumeer.core.cache.UserCache in project engine by Lumeer.

the class PermissionsCheckerTest method preparePermissionsChecker.

@Before
public void preparePermissionsChecker() {
    User user = Mockito.mock(User.class);
    Mockito.when(user.getGroups()).thenReturn(Collections.singletonMap("LMR", Collections.singleton(GROUP)));
    UserCache userCache = Mockito.mock(UserCache.class);
    Mockito.when(userCache.getUser(USER)).thenReturn(user);
    AuthenticatedUser authenticatedUser = Mockito.mock(AuthenticatedUser.class);
    Mockito.when(authenticatedUser.getCurrentUsername()).thenReturn(USER);
    Mockito.when(authenticatedUser.getUserEmail()).thenReturn(USER);
    Mockito.when(authenticatedUser.getCurrentUserGroups()).thenReturn(Collections.singleton(GROUP));
    permissionsChecker = new PermissionsChecker(userCache, authenticatedUser);
}
Also used : User(io.lumeer.api.model.User) UserCache(io.lumeer.core.cache.UserCache) Before(org.junit.Before)

Aggregations

User (io.lumeer.api.model.User)1 UserCache (io.lumeer.core.cache.UserCache)1 Before (org.junit.Before)1