langflow
langflow copied to clipboard
feat: Add unit tests for run_flow_from_json with fake environment variables
Added Tests for run_flow_from_json Functionality
Description
This PR introduces new unit tests for the run_flow_from_json
function to ensure it correctly handles environment variables. The following tests have been added:
-
test_run_flow_with_fake_env: Validates the flow execution using a fake
.env
file, ensuring that the expected output is returned. -
test_run_flow_with_fake_env_TWEAKS: Checks the flow execution when environment variables are loaded from the fake
.env
file, confirming that the output matches the expected result.
Motivation
These tests enhance the reliability of the run_flow_from_json
function by verifying its behavior with different configurations of environment variables, which is crucial for maintaining functionality in various deployment scenarios.
Changes
- Added
test_run_flow_with_fake_env
to test flow execution with a fake environment. - Added
test_run_flow_with_fake_env_TWEAKS
to test flow execution with environment variables loaded from a fake.env
file. - Implemented a function to recursively replace keys in the tweaks dictionary with values from the provided environment variables. This Fixes the issue of ENV variables not loading when using
run_flow_from_json