Merge branch '2.7.x' into 3.0.x

Closes gh-38247
This commit is contained in:
Moritz Halbritter
2023-11-07 11:24:16 +01:00
2 changed files with 21 additions and 4 deletions

View File

@@ -37,6 +37,7 @@ import static org.mockito.BDDMockito.then;
* Tests for {@link EncodePasswordCommand}.
*
* @author Phillip Webb
* @author Moritz Halbritter
*/
@ExtendWith(MockitoExtension.class)
class EncodePasswordCommandTests {
@@ -67,6 +68,17 @@ class EncodePasswordCommandTests {
assertThat(status).isEqualTo(ExitStatus.OK);
}
@Test
void encodeWithDefaultShouldUseBcrypt() throws Exception {
EncodePasswordCommand command = new EncodePasswordCommand();
ExitStatus status = command.run("-a", "default", "boot");
then(this.log).should().info(this.message.capture());
assertThat(this.message.getValue()).startsWith("{bcrypt}");
assertThat(PasswordEncoderFactories.createDelegatingPasswordEncoder().matches("boot", this.message.getValue()))
.isTrue();
assertThat(status).isEqualTo(ExitStatus.OK);
}
@Test
void encodeWithBCryptShouldUseBCrypt() throws Exception {
EncodePasswordCommand command = new EncodePasswordCommand();