langflow/src/backend/tests/unit
Edwin Jose b093c1fadb
refactor(session): migrate to server-based session management and add tests (#9077)
* update MCP Tests

* [autofix.ci] apply automated fixes

* Update util.py

* [autofix.ci] apply automated fixes

* Refactor MCP session manager for better configurability and cleanup (#9176)

* Add log rotation and header validation features

Introduces support for log rotation via the LANGFLOW_LOG_ROTATION environment variable and CLI/config options, with documentation updates. Adds header validation and sanitization for MCP connections, ensuring RFC 7230 compliance and security. Frontend and backend now support passing custom headers for MCP servers. Includes extensive new and updated unit tests for header handling, MCP utilities, and log rotation.

* Add unit tests for MCP utilities and update disconnect logic

Added comprehensive unit tests for MCP utility functions, session management, header validation, and client classes in test_mcp_util.py. Updated MCPStdioClient and MCPSseClient disconnect methods for clearer session cleanup logic. Refactored test_mcp_component.py to remove redundant and duplicated tests, consolidating coverage in the new test suite.

* [autofix.ci] apply automated fixes

* Update test_mcp_memory_leak.py

* Update util.py

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2025-08-09 09:30:39 +00:00
..
api feat: adds authentication to mcp server under feature flag (#9095) 2025-07-22 20:04:47 +00:00
base refactor(session): migrate to server-based session management and add tests (#9077) 2025-08-09 09:30:39 +00:00
components refactor(session): migrate to server-based session management and add tests (#9077) 2025-08-09 09:30:39 +00:00
custom fix: Exclude base path from custom component loading (#9098) 2025-07-28 19:00:44 +00:00
events ref: Some ruff fixes from preview (#5420) 2024-12-28 21:25:35 +00:00
exceptions ref: Some ruff fixes from preview (#5420) 2024-12-28 21:25:35 +00:00
graph feat: update if-else component (#8756) 2025-07-02 22:56:57 +00:00
helpers fix: component MCP Tools (SSE): 'Timeout' (#5638) 2025-03-14 12:48:53 +00:00
initial_setup refactor: reorganize components and update PromptComponent with priority attribute (#8667) 2025-06-27 17:02:06 +00:00
inputs feat: add new Tab input (#7032) 2025-03-17 14:10:48 +00:00
io feat: create an IO Category (#8229) 2025-05-30 17:58:34 +00:00
schema fix: don't send duplicate messages to Agent (#8909) 2025-07-08 01:36:39 +00:00
serialization fix: truncate transaction and vertex messages (#7893) 2025-05-06 00:03:13 +00:00
services feat: flow_runner better init and remove the depend on old load func (#7933) 2025-06-26 15:14:35 +00:00
template refactor(tests): parameterize template tests and update timeout use (#9224) 2025-07-29 22:32:48 +00:00
utils refactor(tests): parameterize template tests and update timeout use (#9224) 2025-07-29 22:32:48 +00:00
__init__.py refactor: improve maintainability and testability of Vertex.build_params (#5808) 2025-03-11 15:34:15 +00:00
build_utils.py feat: combine chat history and chat store into a CRUD component (#8323) 2025-06-05 22:19:01 +00:00
mock_language_model.py feat: Enhance StructuredOutputComponent and add trustcall dependency (#7249) 2025-04-02 18:50:28 +00:00
test_api_key.py ref: Add ALL ruff rules for tests (#4183) 2024-10-19 20:41:37 +00:00
test_async_helpers.py fix: handle EventLoopBlockError in CI to fix non-deterministic test failures (#8890) 2025-07-08 09:59:46 -03:00
test_chat_endpoint.py feat: New Search Bundle (#8146) 2025-05-23 21:51:04 +00:00
test_cli.py test(cli): refactor test_components_path to use async thread and free port (#8748) 2025-06-26 19:04:27 +00:00
test_code_hash.py feat: add module and code hash to component's metadata (#8737) 2025-07-18 18:03:17 +00:00
test_custom_component.py fix: Use relative paths for data files in unit tests (#6021) 2025-01-30 12:34:31 +00:00
test_custom_component_with_client.py ref: Make list_flows async (#5222) 2024-12-12 16:02:43 +00:00
test_data_class.py fix: update data validation in Data model (#6789) 2025-03-05 13:49:23 +00:00
test_database.py feat: Add MCP Server Settings to projects, rename Folder to Project (#7741) 2025-04-29 14:14:55 -03:00
test_endpoints.py refactor: reorganize components and update PromptComponent with priority attribute (#8667) 2025-06-27 17:02:06 +00:00
test_experimental_components.py ref: Remove autouse from pytest client fixture (#4158) 2024-10-15 22:55:10 +00:00
test_frontend_nodes.py ref: Auto-fix ruff rules in tests (#4154) 2024-10-16 15:42:36 +00:00
test_helper_components.py feat: Refactor langflow Components - Consolidate Imports, Remove Unused Components, and Update Astra Assistant Icons (#4460) 2024-11-11 19:30:05 +00:00
test_import_utils.py refactor(core): implement centralized dynamic lazy import system for components (#8932) 2025-08-05 20:48:59 +00:00
test_initial_setup.py feat: Add smoke tests workflow for PR validation (#9125) 2025-07-28 18:27:05 +00:00
test_kubernetes_secrets.py ref: Add ALL ruff rules for tests (#4183) 2024-10-19 20:41:37 +00:00
test_load_components.py refactor: load components by importing them directly (#8395) 2025-06-11 22:36:35 +00:00
test_loading.py ref: Make load_flow_from_json async (#5057) 2024-12-11 17:53:33 +00:00
test_logger.py ref: Auto-fix ruff rules in tests (#4154) 2024-10-16 15:42:36 +00:00
test_login.py ref: Remove unused sync session_scope, with_session and engine (#5333) 2024-12-18 20:52:06 +00:00
test_messages.py fix: make sure tests run async (#5842) 2025-01-21 08:16:33 -08:00
test_messages_endpoints.py feat: add sessions endpoint with session management enhancements (#8596) 2025-06-23 14:11:07 +00:00
test_process.py ref: Remove some useless asyncio.to_thread (#5149) 2024-12-08 20:13:08 +01:00
test_schema.py fix: make starter projects auto refactor not remove selected output (#8400) 2025-06-11 14:10:22 +00:00
test_session_endpoint.py feat: add sessions endpoint with session management enhancements (#8596) 2025-06-23 14:11:07 +00:00
test_setup_superuser.py ref: make superuser creation more multi-user friendly (#9019) 2025-07-23 18:45:03 +00:00
test_telemetry.py ref: Some ruff fixes from preview (#5420) 2024-12-28 21:25:35 +00:00
test_template.py fix: component MCP Tools (SSE): 'Timeout' (#5638) 2025-03-14 12:48:53 +00:00
test_user.py ref: Make initialize_database async (#5163) 2024-12-10 07:44:34 +01:00
test_validate_code.py fix: Ensure importability of modules not included in __init__.py files (#5965) 2025-01-28 12:18:40 +00:00
test_version.py ref: Auto-fix ruff rules in tests (#4154) 2024-10-16 15:42:36 +00:00
test_voice_mode.py feat: conditionally render voice button based on voice mode state (#8561) 2025-06-17 15:23:12 +00:00
test_webhook.py refactor: add graph utility tests and refactor sorting methods (#5538) 2025-01-09 20:15:24 +00:00