mirror of
https://github.com/iflytek/skillhub.git
synced 2026-10-03 02:24:36 +00:00
fix(tests): 移除 LocalAuthServiceTest 中不必要的 ldapProperties stub
将 ldapProperties.isEnabled() 的默认 stub 从 setUp() 移到 login_withUnknownUsername_stillPerformsDummyPasswordCheck 中, 消除 7 个测试方法的 UnnecessaryStubbingException。 Signed-off-by: jangrui <admin@jangrui.com>
This commit is contained in:
parent
d09d6172c1
commit
ea3bf08e19
1 changed files with 1 additions and 3 deletions
|
|
@ -65,9 +65,6 @@ class LocalAuthServiceTest {
|
|||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
// 默认禁用 LDAP,确保原有测试不受影响
|
||||
given(ldapProperties.isEnabled()).willReturn(false);
|
||||
|
||||
service = new LocalAuthService(
|
||||
credentialRepository,
|
||||
userAccountRepository,
|
||||
|
|
@ -176,6 +173,7 @@ class LocalAuthServiceTest {
|
|||
@Test
|
||||
void login_withUnknownUsername_stillPerformsDummyPasswordCheck() {
|
||||
given(credentialRepository.findByUsernameIgnoreCase("ghost")).willReturn(Optional.empty());
|
||||
given(ldapProperties.isEnabled()).willReturn(false);
|
||||
given(passwordEncoder.matches(eq("bad"), eq("$2a$12$8Q/2o2A0V.b18G2DutV4c.s5zZxH6MECM7tP8mYv6b6Q6x6o9v3vu")))
|
||||
.willReturn(false);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue