Migrate storage to DogeCloud and expand admin dashboard
This commit is contained in:
@@ -53,7 +53,7 @@ class AuthControllerValidationTest {
|
||||
"""))
|
||||
.andExpect(status().isBadRequest())
|
||||
.andExpect(jsonPath("$.code").value(1000))
|
||||
.andExpect(jsonPath("$.msg").value("密码至少10位,且必须包含大写字母、小写字母、数字和特殊字符"));
|
||||
.andExpect(jsonPath("$.msg").value("密码至少8位,且必须包含大写字母"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -14,49 +14,34 @@ class PasswordPolicyTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldRejectPasswordShorterThanTenCharacters() {
|
||||
assertThat(PasswordPolicy.isStrong("Abc1!defg")).isFalse(); // 9 chars
|
||||
void shouldRejectPasswordShorterThanEightCharacters() {
|
||||
assertThat(PasswordPolicy.isStrong("Abcdefg")).isFalse(); // 7 chars
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldAcceptPasswordWithExactlyTenCharacters() {
|
||||
assertThat(PasswordPolicy.isStrong("Abcdefg1!x")).isTrue(); // 10 chars
|
||||
void shouldAcceptPasswordWithExactlyEightCharacters() {
|
||||
assertThat(PasswordPolicy.isStrong("Abcdefgh")).isTrue(); // 8 chars
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldRejectPasswordMissingUppercase() {
|
||||
assertThat(PasswordPolicy.isStrong("abcdefg1!x")).isFalse();
|
||||
assertThat(PasswordPolicy.isStrong("abcdefgh")).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldRejectPasswordMissingLowercase() {
|
||||
assertThat(PasswordPolicy.isStrong("ABCDEFG1!X")).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldRejectPasswordMissingDigit() {
|
||||
assertThat(PasswordPolicy.isStrong("Abcdefgh!x")).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldRejectPasswordMissingSpecialCharacter() {
|
||||
assertThat(PasswordPolicy.isStrong("Abcdefg12x")).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldAcceptStrongPasswordWithAllRequirements() {
|
||||
assertThat(PasswordPolicy.isStrong("MyP@ssw0rd!")).isTrue();
|
||||
void shouldAcceptPasswordThatOnlyNeedsUppercaseAndLength() {
|
||||
assertThat(PasswordPolicy.isStrong("ABCDEFGH")).isTrue();
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ValueSource(strings = {"", "short", "nouppercase1!", "NOLOWERCASE1!", "NoSpecialChar1", "NoDigit!AbcXyz"})
|
||||
@ValueSource(strings = {"", "short", "noupper", "abcdefghi"})
|
||||
void shouldRejectWeakPasswords(String password) {
|
||||
assertThat(PasswordPolicy.isStrong(password)).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldAcceptLongPasswordWithAllRequirements() {
|
||||
assertThat(PasswordPolicy.isStrong("MyV3ryStr0ng&SecureP@ssword2024!")).isTrue();
|
||||
void shouldAcceptLongPasswordWithUppercase() {
|
||||
assertThat(PasswordPolicy.isStrong("MyVerySimplePassword")).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -26,7 +26,7 @@ class RegisterRequestValidationTest {
|
||||
|
||||
assertThat(violations)
|
||||
.extracting(violation -> violation.getMessage())
|
||||
.contains("密码至少10位,且必须包含大写字母、小写字母、数字和特殊字符");
|
||||
.contains("密码至少8位,且必须包含大写字母");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -35,8 +35,8 @@ class RegisterRequestValidationTest {
|
||||
"alice",
|
||||
"alice@example.com",
|
||||
"13800138000",
|
||||
"StrongPass1!",
|
||||
"StrongPass1!",
|
||||
"Abcdefgh",
|
||||
"Abcdefgh",
|
||||
"invite-code"
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user