@Test public void shouldLoginAsAdmin() { final RestTestUser admin = AuthEndPointsHandler.loginAsAdmin(); boolean userIsAdmin = UserEndPointsHandler.isUserAdmin(admin.getUserId()); assertThat(userIsAdmin, is(Boolean.TRUE)); AdminCategoryEndPointsHandler.getItems(); }
@Test public void shouldLogin() { UserRegData anotherUserData = RandomUtils.randomUser(); UserDTO anotherUser = AuthEndPointsHandler.registerNewUser(anotherUserData); AuthResponse authResponse = AuthEndPointsHandler.login(anotherUserData.getLogin(), anotherUserData.getPassword()); boolean userIsAdmin = UserEndPointsHandler.isUserAdmin(AuthEndPointsHandler.readUserId(authResponse)); assertThat(userIsAdmin, is(Boolean.FALSE)); }