You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.6 KiB
47 lines
1.6 KiB
package de.superx.spring.service; |
|
|
|
import static org.junit.Assert.assertEquals; |
|
import static org.junit.Assert.assertNotNull; |
|
import static org.junit.Assert.assertTrue; |
|
|
|
import java.util.List; |
|
|
|
import org.junit.Test; |
|
import org.springframework.beans.factory.annotation.Autowired; |
|
import org.springframework.test.context.ContextConfiguration; |
|
|
|
import de.superx.BaseDbTest; |
|
import de.superx.TestApplicationConfigPg; |
|
import de.superx.common.SxUser; |
|
import de.superx.spring.TestUserServiceImpl; |
|
|
|
//@ContextConfiguration(classes = { TestApplicationConfigPg.class }) |
|
public class TestUserServiceImplTest extends BaseDbTest { |
|
|
|
@Autowired |
|
UserService userService; |
|
|
|
|
|
@Test |
|
public void testCreateNonAdminUser() { |
|
TestUserServiceImpl tusi = (TestUserServiceImpl) userService; |
|
SxUser user = tusi.createTestUser(false, null); |
|
assertNotNull("Non admin user create", user); |
|
assertTrue("Non admin user", user.isAdmin() == false); |
|
} |
|
|
|
@Test |
|
public void testCreateAdminUser() { |
|
TestUserServiceImpl tusi = (TestUserServiceImpl) userService; |
|
SxUser user = tusi.createTestUser(true, null); |
|
assertNotNull("Non admin user create", user); |
|
assertTrue("Non admin user", user.isAdmin() == true); |
|
} |
|
|
|
@Test |
|
public void testCreateUserWithMaskRights() { |
|
TestUserServiceImpl tusi = (TestUserServiceImpl) userService; |
|
SxUser user = tusi.createTestUser(true, List.of(Integer.valueOf(160440), Integer.valueOf(26040))); |
|
assertEquals("Non admin user", ",160440,26040,", user.getMaskRights()); |
|
} |
|
}
|
|
|