* Refactor Alembic environment script to simplify database connection logic and remove unused imports
* Refactor test client fixture to use TemporaryDirectory and UUID for database path
* Add `reload_engine` method to reinitialize the database engine
* Add cleanup steps to test fixtures to ensure proper resource management
- Added cleanup steps to various pytest fixtures to ensure temporary directories, database entries, and other resources are properly cleaned up after tests.
- Modified fixtures to use `yield` for better resource management.
- Ensured database connections are closed and tables are dropped after tests.
- Improved temporary directory handling with context managers.
* Add unit test to verify return type of list_flows method in custom component
* Refactor tests in `test_custom_component.py` to remove unused imports and fixtures, and update existing fixtures for consistency.
* Add debug checks for user existence in `test_user_waiting_for_approval` test
* Fix import order and add flow_id validation in transaction handling
- Corrected the import order in `utils.py`.
- Added validation for `flow_id` in the transaction handling logic to ensure it is set correctly.
* Add function to delete transactions by flow ID in CRUD module
* Add cleanup for transactions and vertex builds in test teardown
- Introduced `_delete_transactions_and_vertex_builds` function to remove transactions and vertex builds associated with a user.
- Updated `user` fixture to call the new cleanup function before deleting the user.
* Refactor flow_id assignment logic in `utils.py` to improve readability and correctness
* [autofix.ci] apply automated fixes
* Refactor test to use pytest's tmp_path fixture for temporary directory creation
* Convert `test_user_waiting_for_approval` to an async test function
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* Add async support and dependencies to pyproject.toml files
- Added `asgi-lifespan>=2.1.0` to dependencies.
- Configured `asyncio_mode` and `asyncio_default_fixture_loop_scope` for pytest.
- Updated `tool.uv` section with `asgi-lifespan` in dev-dependencies.
* Convert test fixtures to async and use AsyncClient for HTTP requests
* Handle 'ImportFrom' nodes in AST validation to support module attribute imports
* Convert test cases to use async HTTP client
- Updated test cases in `test_database.py`, `test_endpoints.py`, `test_user.py`, `test_variable.py`, `test_files.py`, `test_chat_endpoint.py`, `test_misc.py`, `test_messages_endpoints.py`, `test_api_key.py`, `test_webhook.py`, and `test_login.py` to use `httpx.AsyncClient` instead of `fastapi.TestClient`.
- Modified test functions to be asynchronous and use `await` for HTTP requests.
- Adjusted fixtures and helper functions to support asynchronous operations.
- Ensured consistency in endpoint paths and request methods across all test cases.
* Refactor string concatenation to f-string in test_chat_endpoint.py
* [autofix.ci] apply automated fixes
* Refactor import validation to use pattern matching for AST nodes
* Set `startup_timeout` and `shutdown_timeout` to `None` in `LifespanManager` for test files.
* Convert test functions to async in `test_messages_endpoints.py`
* Add `api_key_required` marker to assistant component tests
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>