feat: 主题切换 + 浅色模式适配,SFTP/批量命令/Webhook/仪表盘全面升级
This commit is contained in:
@@ -42,6 +42,12 @@ class ConnectionServiceTest {
|
||||
@Mock
|
||||
private SshBootstrapService sshBootstrapService;
|
||||
|
||||
@Mock
|
||||
private WebhookService webhookService;
|
||||
|
||||
@Mock
|
||||
private QuickConnectionRegistry quickConnectionRegistry;
|
||||
|
||||
@InjectMocks
|
||||
private ConnectionService connectionService;
|
||||
|
||||
|
||||
@@ -28,17 +28,21 @@ class SftpServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testPasswordAuthenticationRequiredWithValidConnection() {
|
||||
void testQuickConnectWithEmptyPasswordUsesKeyboardInteractive() {
|
||||
// Quick-connect connections have empty password — should NOT throw
|
||||
// (they fall back to keyboard-interactive auth)
|
||||
Connection conn = new Connection();
|
||||
conn.setHost("127.0.0.1");
|
||||
conn.setPort(22);
|
||||
conn.setUsername("test");
|
||||
conn.setAuthType(Connection.AuthType.PASSWORD);
|
||||
// This will try to connect to 127.0.0.1 and fail with connection refused,
|
||||
// but it should NOT fail with "password is empty" anymore
|
||||
Exception exception = assertThrows(Exception.class, () -> {
|
||||
Connection conn = new Connection();
|
||||
conn.setHost("127.0.0.1");
|
||||
conn.setPort(22);
|
||||
conn.setUsername("test");
|
||||
conn.setAuthType(Connection.AuthType.PASSWORD);
|
||||
sftpService.connect(conn, "", null, null);
|
||||
sftpService.connect(conn, "__quick__", null, null);
|
||||
});
|
||||
assertTrue(exception.getMessage().contains("Password is required") ||
|
||||
exception instanceof IllegalArgumentException);
|
||||
// Should fail with connection/timeout, not password validation
|
||||
assertFalse(exception.getMessage().contains("password is empty"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user