langflow/tests
Gabriel Luiz Freitas Almeida 94e8bf1e2b
Add support for running flows by endpoint name (#2012)
* feat: Add support for running flows by endpoint name

This commit modifies the `simplified_run_flow` endpoint in `endpoints.py` to allow running flows using the endpoint name instead of the flow ID. It introduces a new route parameter `flow_id_or_name` which can accept either a UUID or a string representing the endpoint name. The code first attempts to parse the parameter as a UUID, and if that fails, it queries the database to find a flow with the matching endpoint name. This change improves the usability of the API by providing an alternative way to identify flows for execution.

* feat: Add endpoint_name field to FlowType

This commit adds the `endpoint_name` field to the `FlowType` interface in the `index.ts` file. The `endpoint_name` field is an optional string that represents the name of the endpoint associated with the flow. This change allows for more flexibility in identifying flows by endpoint name instead of just the flow ID. It improves the usability of the codebase by providing an alternative way to reference flows.

* 🐛 (endpoints.py): change type of flow_id_or_name parameter from Union[str, UUID] to str to simplify the API and improve readability

* feat: Add migration utility functions for table, column, foreign key, and constraint existence checks

This commit adds utility functions to the `migration.py` module in the `langflow.utils` package. These functions provide convenient ways to check the existence of tables, columns, foreign keys, and constraints in a database using SQLAlchemy. The functions `table_exists`, `column_exists`, `foreign_key_exists`, and `constraint_exists` take the table name, column name, foreign key name, and constraint name respectively, along with the SQLAlchemy engine or connection object. They use the `Inspector` class from `sqlalchemy.engine.reflection` to retrieve the necessary information and return a boolean value indicating whether the specified element exists in the database. These utility functions improve the readability and maintainability of the codebase by encapsulating the common existence checks in a reusable and modular way.

* feat: Add unique constraints for per-user folders and flows

This commit adds unique constraints for per-user folders and flows in the database. It introduces the `unique_folder_name` constraint for the `folder` table, ensuring that each user can have only one folder with a specific name. Similarly, it adds the `unique_flow_endpoint_name` and `unique_flow_name` constraints for the `flow` table, enforcing uniqueness of endpoint names and flow names per user. These constraints improve data integrity and prevent duplicate entries in the database, providing a more robust and reliable system.

* feat: Add poetry installation and caching steps to GitHub Actions workflow

This commit updates the GitHub Actions workflow file `action.yml` to include additional steps for installing poetry and caching its dependencies. The `run` step now installs poetry using the specified version and ensures that the poetry binary is available in the PATH. Additionally, the workflow now includes a step to restore pip and poetry cached dependencies using the `actions/cache` action. These changes improve the workflow by providing a more efficient and reliable way to manage poetry dependencies and caching.

* refactor: Improve error handling in update_flow function

This commit improves the error handling in the `update_flow` function in `flows.py`. It adds a new `elif` condition to check if the exception is an instance of `HTTPException` and re-raises it. This ensures that any `HTTPException` raised during the update process is properly handled and returned as a response. Additionally, it removes the unnecessary `else` block and simplifies the code logic. This refactor enhances the reliability and maintainability of the `update_flow` function.
2024-05-30 07:46:28 -07:00
..
data 1.0 Alpha (#1599) 2024-04-04 02:46:44 -03:00
locust Reapply "Refactor state management to use Zustand, migrate components to CustomComponent and other fixes" 2024-02-05 19:02:34 -03:00
__init__.py feat(tests): add __init__.py and utils.py files to tests directory for test setup and utility functions 2023-09-05 12:24:43 -03:00
conftest.py Fix lint and tests (#1959) 2024-05-23 07:55:06 -07:00
test_api_key.py Update datetime handling in ApiKey and Variable models (#1673) 2024-04-10 23:04:10 -03:00
test_cache.py 1.0 Alpha (#1599) 2024-04-04 02:46:44 -03:00
test_cli.py Update settings attributes and remove config.yaml references (#1975) 2024-05-26 07:24:21 -07:00
test_custom_component.py chore: remove unused files and update imports (#1967) 2024-05-24 13:13:38 -07:00
test_data_components.py Added curl parse to API Request component and fixed dict issues (#2013) 2024-05-30 06:50:31 -07:00
test_database.py Add support for running flows by endpoint name (#2012) 2024-05-30 07:46:28 -07:00
test_endpoints.py Add support for running flows by endpoint name (#2012) 2024-05-30 07:46:28 -07:00
test_files.py 1.0 Alpha (#1599) 2024-04-04 02:46:44 -03:00
test_frontend_nodes.py Refactor imports and update function names 2024-01-25 16:17:40 -03:00
test_graph.py Format code and update langflow version (#1922) 2024-05-19 19:17:18 -07:00
test_helper_components.py chore: remove unused files and update imports (#1967) 2024-05-24 13:13:38 -07:00
test_initial_setup.py Fix lint and tests (#1959) 2024-05-23 07:55:06 -07:00
test_loading.py chore: remove unused files and update imports (#1967) 2024-05-24 13:13:38 -07:00
test_login.py Update datetime handling in ApiKey and Variable models (#1673) 2024-04-10 23:04:10 -03:00
test_process.py Fix various issues and refactor code (#1671) 2024-04-10 22:40:21 -03:00
test_record.py 1.0 Alpha (#1599) 2024-04-04 02:46:44 -03:00
test_setup_superuser.py 1.0 Alpha (#1599) 2024-04-04 02:46:44 -03:00
test_template.py Changes default location for the database and adds the option to use the previous behavior (#1907) 2024-05-15 20:41:01 -03:00
test_user.py 1.0 Alpha (#1599) 2024-04-04 02:46:44 -03:00
test_validate_code.py formatting 2023-03-31 14:06:40 -03:00
text_experimental_components.py 1.0 Alpha (#1599) 2024-04-04 02:46:44 -03:00
utils.py 🐛 fix(basic_example.json): change value of "value" key from "abc" to null to remove hardcoded value and improve flexibility 2023-09-22 11:06:25 -03:00