This repository has been archived by the owner on Sep 24, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
Showing
7 changed files
with
75 additions
and
18 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
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 |
---|---|---|
|
@@ -538,6 +538,50 @@ public void testSaveExistingEmail() throws Exception { | |
assertThat(updatedUser.getEmail()).isEqualTo("[email protected]"); | ||
} | ||
|
||
@Test | ||
@Transactional | ||
@WithMockUser("save-existing-email-and-login") | ||
public void testSaveExistingEmailAndLogin() throws Exception { | ||
User user = new User(); | ||
user.setLogin("save-existing-email-and-login"); | ||
user.setEmail("[email protected]"); | ||
user.setPassword(RandomStringUtils.random(60)); | ||
user.setActivated(true); | ||
|
||
userRepository.saveAndFlush(user); | ||
|
||
User anotherUser = new User(); | ||
anotherUser.setLogin("save-existing-email-and-login"); | ||
anotherUser.setEmail("[email protected]"); | ||
anotherUser.setPassword(RandomStringUtils.random(60)); | ||
anotherUser.setActivated(true); | ||
|
||
UserDTO userDTO = new UserDTO( | ||
null, // id | ||
"not-used", // login | ||
"firstname", // firstName | ||
"lastname", // lastName | ||
"[email protected]", // email | ||
false, // activated | ||
"http://placehold.it/50x50", //imageUrl | ||
"en", // langKey | ||
null, // createdBy | ||
null, // createdDate | ||
null, // lastModifiedBy | ||
null, // lastModifiedDate | ||
new HashSet<>(Collections.singletonList(AuthoritiesConstants.ADMIN)) | ||
); | ||
|
||
restMvc.perform( | ||
post("/api/account") | ||
.contentType(TestUtil.APPLICATION_JSON_UTF8) | ||
.content(TestUtil.convertObjectToJsonBytes(userDTO))) | ||
.andExpect(status().isOk()); | ||
|
||
User updatedUser = userRepository.findOneByLogin("save-existing-email-and-login").orElse(null); | ||
assertThat(updatedUser.getEmail()).isEqualTo("[email protected]"); | ||
} | ||
|
||
@Test | ||
@Transactional | ||
@WithMockUser("change-password") | ||
|
@@ -589,6 +633,23 @@ public void testChangePasswordTooLong() throws Exception { | |
assertThat(updatedUser.getPassword()).isEqualTo(user.getPassword()); | ||
} | ||
|
||
@Test | ||
@Transactional | ||
@WithMockUser("change-password-empty") | ||
public void testChangePasswordEmpty() throws Exception { | ||
User user = new User(); | ||
user.setPassword(RandomStringUtils.random(60)); | ||
user.setLogin("change-password-empty"); | ||
user.setEmail("[email protected]"); | ||
userRepository.saveAndFlush(user); | ||
|
||
restMvc.perform(post("/api/account/change_password").content(RandomStringUtils.random(0))) | ||
.andExpect(status().isBadRequest()); | ||
|
||
User updatedUser = userRepository.findOneByLogin("change-password-empty").orElse(null); | ||
assertThat(updatedUser.getPassword()).isEqualTo(user.getPassword()); | ||
} | ||
|
||
@Test | ||
@Transactional | ||
public void testRequestPasswordReset() throws Exception { | ||
|
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 |
---|---|---|
|
@@ -2297,9 +2297,9 @@ generate-object-property@^1.1.0: | |
dependencies: | ||
is-property "^1.0.0" | ||
|
||
[email protected].0: | ||
version "4.4.0" | ||
resolved "https://registry.yarnpkg.com/generator-jhipster/-/generator-jhipster-4.4.0.tgz#ef23ecf9ea53a4e80064f1db2baf904bd717062f" | ||
[email protected].1: | ||
version "4.4.1" | ||
resolved "https://registry.yarnpkg.com/generator-jhipster/-/generator-jhipster-4.4.1.tgz#8915817c2023997af85c55edcb6f6719f41f5c1c" | ||
dependencies: | ||
chalk "1.1.3" | ||
cheerio "0.22.0" | ||
|