langflow/src/backend/tests
Gabriel Luiz Freitas Almeida 2c405f77e7
feat(utils): add code hash generation and module name in Custom Components (#9107)
* refactor: update _generate_code_hash function and enhance module name handling

- Removed the class_name parameter from _generate_code_hash for improved clarity and simplicity.
- Added a new function, get_module_name_from_display_name, to generate module names from display names in snake_case.
- Updated build_custom_component_template_from_inputs to use the new module name generation logic when module_name is None.
- Enhanced error handling in code hash generation to log exceptions appropriately.
- Updated unit tests to reflect changes in the _generate_code_hash function and to verify the new module name generation functionality.

* fix: enhance module name handling and error logging in build_custom_component_template

- Added logic to derive module names from display names when not provided, improving metadata accuracy.
- Refined error handling for code hash generation, ensuring exceptions are logged appropriately for better debugging.

* test: add comprehensive unit tests for metadata generation in custom components

- Introduced multiple tests to ensure that the `build_custom_component_template` function consistently generates metadata, including module names and code hashes, across various scenarios.
- Verified that metadata is correctly returned when module names are provided or omitted, and that code hashes change with component code modifications.
- Included tests for handling unicode characters in component code to ensure robustness in metadata generation.

* test: update unit tests to use Component class for metadata generation

- Refactored test cases to replace the CustomComponent with the new Component class, ensuring consistency in testing metadata addition in template builders.
- Adjusted mock component attributes to align with the updated class structure, enhancing clarity and maintainability of the tests.

* test: add unit tests for custom component metadata retrieval and consistency

- Introduced new tests for the /custom_component endpoint to verify that it returns accurate metadata, including module names and code hashes.
- Ensured that identical component code produces consistent metadata across multiple requests, enhancing the reliability of the custom component functionality.

* refactor: improve error logging in code hash generation

- Updated error logging in `build_custom_component_template_from_inputs` and `build_custom_component_template` to use debug level with exception context, enhancing clarity for debugging while reducing log noise.
- This change aims to provide more detailed insights during error occurrences without cluttering the error logs.
2025-08-18 13:56:29 +00:00
..
data feat: combine chat history and chat store into a CRUD component (#8323) 2025-06-05 22:19:01 +00:00
integration refactor: Skip MCP Memory leak integration test (#9358) 2025-08-12 09:26:03 -03:00
locust refactor(tests): parameterize template tests and update timeout use (#9224) 2025-07-29 22:32:48 +00:00
performance tests: Remove unnecessary benchmark markers from server init tests (#5806) 2025-01-20 16:43:46 +00:00
unit feat(utils): add code hash generation and module name in Custom Components (#9107) 2025-08-18 13:56:29 +00:00
.test_durations chore: update test durations (#8550) 2025-06-16 11:05:18 -03:00
__init__.py refactor: improve maintainability and testability of Vertex.build_params (#5808) 2025-03-11 15:34:15 +00:00
api_keys.py ref: Auto-fix ruff rules in tests (#4154) 2024-10-16 15:42:36 +00:00
base.py fix: make sure tests run async (#5842) 2025-01-21 08:16:33 -08:00
conftest.py fix: Improve session fixture cleanup and engine handling (#9352) 2025-08-11 16:45:06 -03:00
constants.py chore: Update supported versions in tests constants (#5569) 2025-01-07 15:43:49 +00:00