feat: Add components_only parameter to filter flows by components in API endpoint (#3932)
* Add fixture for creating flow component in tests * Add test for reading flows with components only in test_database.py * Add `components_only` parameter to filter flows by components in API endpoint
This commit is contained in:
parent
6db15255a5
commit
35d81b7e34
3 changed files with 32 additions and 9 deletions
|
|
@ -67,6 +67,14 @@ def test_read_flows(client: TestClient, json_flow: str, active_user, logged_in_h
|
|||
assert len(response.json()) > 0
|
||||
|
||||
|
||||
def test_read_flows_components_only(client: TestClient, flow_component: dict, logged_in_headers):
|
||||
response = client.get("api/v1/flows/", headers=logged_in_headers, params={"components_only": True})
|
||||
assert response.status_code == 200
|
||||
names = [flow["name"] for flow in response.json()]
|
||||
assert any("Chat Input Component" in name for name in names)
|
||||
assert all(flow["is_component"] is True for flow in response.json()), [flow["name"] for flow in response.json()]
|
||||
|
||||
|
||||
def test_read_flow(client: TestClient, json_flow: str, logged_in_headers):
|
||||
flow = orjson.loads(json_flow)
|
||||
data = flow["data"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue