-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d53a77f
commit 68a217e
Showing
6 changed files
with
15 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,10 +133,7 @@ void testRegisterValid() throws Exception { | |
ManagedUserVM validUser = new ManagedUserVM(); | ||
validUser.setLogin("test-register-valid"); | ||
validUser.setPassword("password"); | ||
// validUser.setFirstName("Alice"); | ||
// validUser.setLastName("Test"); | ||
validUser.setEmail("[email protected]"); | ||
// validUser.setImageUrl("http://placehold.it/50x50"); | ||
validUser.setLangKey(Constants.DEFAULT_LANGUAGE); | ||
validUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); | ||
assertThat(userRepository.findOneByLogin("test-register-valid")).isEmpty(); | ||
|
@@ -156,11 +153,8 @@ void testRegisterInvalidLogin() throws Exception { | |
ManagedUserVM invalidUser = new ManagedUserVM(); | ||
invalidUser.setLogin("funky-log(n"); // <-- invalid | ||
invalidUser.setPassword("password"); | ||
// invalidUser.setFirstName("Funky"); | ||
// invalidUser.setLastName("One"); | ||
invalidUser.setEmail("[email protected]"); | ||
invalidUser.setActivated(true); | ||
// invalidUser.setImageUrl("http://placehold.it/50x50"); | ||
invalidUser.setLangKey(Constants.DEFAULT_LANGUAGE); | ||
invalidUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); | ||
|
||
|
@@ -203,11 +197,8 @@ private static ManagedUserVM createInvalidUser( | |
ManagedUserVM invalidUser = new ManagedUserVM(); | ||
invalidUser.setLogin(login); | ||
invalidUser.setPassword(password); | ||
// invalidUser.setFirstName(firstName); | ||
// invalidUser.setLastName(lastName); | ||
invalidUser.setEmail(email); | ||
invalidUser.setActivated(activated); | ||
// invalidUser.setImageUrl("http://placehold.it/50x50"); | ||
invalidUser.setLangKey(Constants.DEFAULT_LANGUAGE); | ||
invalidUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); | ||
return invalidUser; | ||
|
@@ -220,21 +211,15 @@ void testRegisterDuplicateLogin() throws Exception { | |
ManagedUserVM firstUser = new ManagedUserVM(); | ||
firstUser.setLogin("alice"); | ||
firstUser.setPassword("password"); | ||
// firstUser.setFirstName("Alice"); | ||
// firstUser.setLastName("Something"); | ||
firstUser.setEmail("[email protected]"); | ||
// firstUser.setImageUrl("http://placehold.it/50x50"); | ||
firstUser.setLangKey(Constants.DEFAULT_LANGUAGE); | ||
firstUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); | ||
|
||
// Duplicate login, different email | ||
ManagedUserVM secondUser = new ManagedUserVM(); | ||
secondUser.setLogin(firstUser.getLogin()); | ||
secondUser.setPassword(firstUser.getPassword()); | ||
// secondUser.setFirstName(firstUser.getFirstName()); | ||
// secondUser.setLastName(firstUser.getLastName()); | ||
secondUser.setEmail("[email protected]"); | ||
// secondUser.setImageUrl(firstUser.getImageUrl()); | ||
secondUser.setLangKey(firstUser.getLangKey()); | ||
secondUser.setCreatedBy(firstUser.getCreatedBy()); | ||
secondUser.setCreatedDate(firstUser.getCreatedDate()); | ||
|
@@ -272,10 +257,7 @@ void testRegisterDuplicateEmail() throws Exception { | |
ManagedUserVM firstUser = new ManagedUserVM(); | ||
firstUser.setLogin("test-register-duplicate-email"); | ||
firstUser.setPassword("password"); | ||
// firstUser.setFirstName("Alice"); | ||
// firstUser.setLastName("Test"); | ||
firstUser.setEmail("[email protected]"); | ||
// firstUser.setImageUrl("http://placehold.it/50x50"); | ||
firstUser.setLangKey(Constants.DEFAULT_LANGUAGE); | ||
firstUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); | ||
|
||
|
@@ -291,10 +273,7 @@ void testRegisterDuplicateEmail() throws Exception { | |
ManagedUserVM secondUser = new ManagedUserVM(); | ||
secondUser.setLogin("test-register-duplicate-email-2"); | ||
secondUser.setPassword(firstUser.getPassword()); | ||
// secondUser.setFirstName(firstUser.getFirstName()); | ||
// secondUser.setLastName(firstUser.getLastName()); | ||
secondUser.setEmail(firstUser.getEmail()); | ||
// secondUser.setImageUrl(firstUser.getImageUrl()); | ||
secondUser.setLangKey(firstUser.getLangKey()); | ||
secondUser.setAuthorities(new HashSet<>(firstUser.getAuthorities())); | ||
|
||
|
@@ -314,10 +293,7 @@ void testRegisterDuplicateEmail() throws Exception { | |
userWithUpperCaseEmail.setId(firstUser.getId()); | ||
userWithUpperCaseEmail.setLogin("test-register-duplicate-email-3"); | ||
userWithUpperCaseEmail.setPassword(firstUser.getPassword()); | ||
// userWithUpperCaseEmail.setFirstName(firstUser.getFirstName()); | ||
// userWithUpperCaseEmail.setLastName(firstUser.getLastName()); | ||
userWithUpperCaseEmail.setEmail("[email protected]"); | ||
// userWithUpperCaseEmail.setImageUrl(firstUser.getImageUrl()); | ||
userWithUpperCaseEmail.setLangKey(firstUser.getLangKey()); | ||
userWithUpperCaseEmail.setAuthorities(new HashSet<>(firstUser.getAuthorities())); | ||
|
||
|
@@ -347,11 +323,8 @@ void testRegisterAdminIsIgnored() throws Exception { | |
ManagedUserVM validUser = new ManagedUserVM(); | ||
validUser.setLogin("badguy"); | ||
validUser.setPassword("password"); | ||
// validUser.setFirstName("Bad"); | ||
// validUser.setLastName("Guy"); | ||
validUser.setEmail("[email protected]"); | ||
validUser.setActivated(true); | ||
// validUser.setImageUrl("http://placehold.it/50x50"); | ||
validUser.setLangKey(Constants.DEFAULT_LANGUAGE); | ||
validUser.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN)); | ||
|
||
|
@@ -408,11 +381,8 @@ void testSaveAccount() throws Exception { | |
|
||
AdminUserDTO userDTO = new AdminUserDTO(); | ||
userDTO.setLogin("not-used"); | ||
// userDTO.setFirstName("firstname"); | ||
// userDTO.setLastName("lastname"); | ||
userDTO.setEmail("[email protected]"); | ||
userDTO.setActivated(false); | ||
// userDTO.setImageUrl("http://placehold.it/50x50"); | ||
userDTO.setLangKey(Constants.DEFAULT_LANGUAGE); | ||
userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN)); | ||
|
||
|
@@ -421,12 +391,11 @@ void testSaveAccount() throws Exception { | |
.andExpect(status().isOk()); | ||
|
||
User updatedUser = userRepository.findOneWithAuthoritiesByLogin(user.getLogin()).orElse(null); | ||
// assertThat(updatedUser.getFirstName()).isEqualTo(userDTO.getFirstName()); | ||
// assertThat(updatedUser.getLastName()).isEqualTo(userDTO.getLastName()); | ||
|
||
assertThat(updatedUser.getEmail()).isEqualTo(userDTO.getEmail()); | ||
assertThat(updatedUser.getLangKey()).isEqualTo(userDTO.getLangKey()); | ||
assertThat(updatedUser.getPassword()).isEqualTo(user.getPassword()); | ||
// assertThat(updatedUser.getImageUrl()).isEqualTo(userDTO.getImageUrl()); | ||
|
||
assertThat(updatedUser.isActivated()).isTrue(); | ||
assertThat(updatedUser.getAuthorities()).isEmpty(); | ||
|
||
|
@@ -447,11 +416,10 @@ void testSaveInvalidEmail() throws Exception { | |
|
||
AdminUserDTO userDTO = new AdminUserDTO(); | ||
userDTO.setLogin("not-used"); | ||
// userDTO.setFirstName("firstname"); | ||
// userDTO.setLastName("lastname"); | ||
|
||
userDTO.setEmail("invalid email"); | ||
userDTO.setActivated(false); | ||
// userDTO.setImageUrl("http://placehold.it/50x50"); | ||
|
||
userDTO.setLangKey(Constants.DEFAULT_LANGUAGE); | ||
userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN)); | ||
|
||
|
@@ -485,11 +453,10 @@ void testSaveExistingEmail() throws Exception { | |
|
||
AdminUserDTO userDTO = new AdminUserDTO(); | ||
userDTO.setLogin("not-used"); | ||
// userDTO.setFirstName("firstname"); | ||
// userDTO.setLastName("lastname"); | ||
|
||
userDTO.setEmail("[email protected]"); | ||
userDTO.setActivated(false); | ||
// userDTO.setImageUrl("http://placehold.it/50x50"); | ||
|
||
userDTO.setLangKey(Constants.DEFAULT_LANGUAGE); | ||
userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN)); | ||
|
||
|
@@ -517,11 +484,10 @@ void testSaveExistingEmailAndLogin() throws Exception { | |
|
||
AdminUserDTO userDTO = new AdminUserDTO(); | ||
userDTO.setLogin("not-used"); | ||
// userDTO.setFirstName("firstname"); | ||
// userDTO.setLastName("lastname"); | ||
|
||
userDTO.setEmail("[email protected]"); | ||
userDTO.setActivated(false); | ||
// userDTO.setImageUrl("http://placehold.it/50x50"); | ||
|
||
userDTO.setLangKey(Constants.DEFAULT_LANGUAGE); | ||
userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN)); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters