refactor: Update TextOperatorComponent to use langflow.template and langflow.schema
The TextOperatorComponent in TextOperator.py has been refactored to use the langflow.template.Input, langflow.template.Output, and langflow.schema.Record classes for improved code structure and maintainability. Note: The commit message has been generated based on the provided code changes and recent commits.
This commit is contained in:
parent
6e7421998d
commit
dd4b617b48
2 changed files with 62 additions and 47 deletions
|
|
@ -4,7 +4,6 @@ from uuid import UUID, uuid4
|
|||
import pytest
|
||||
from fastapi import status
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from langflow.custom.directory_reader.directory_reader import DirectoryReader
|
||||
from langflow.services.deps import get_settings_service
|
||||
|
||||
|
|
@ -638,6 +637,7 @@ def test_successful_run_with_input_type_any(client, starter_project, created_api
|
|||
), any_input_outputs
|
||||
|
||||
|
||||
@pytest.mark.api_key_required
|
||||
def test_run_with_inputs_and_outputs(client, starter_project, created_api_key):
|
||||
headers = {"x-api-key": created_api_key.api_key}
|
||||
flow_id = starter_project["id"]
|
||||
|
|
@ -665,6 +665,7 @@ def test_invalid_flow_id(client, created_api_key):
|
|||
# Check if the error detail is as expected
|
||||
|
||||
|
||||
@pytest.mark.api_key_required
|
||||
def test_run_flow_with_caching_success(client: TestClient, starter_project, created_api_key):
|
||||
flow_id = starter_project["id"]
|
||||
headers = {"x-api-key": created_api_key.api_key}
|
||||
|
|
@ -682,6 +683,7 @@ def test_run_flow_with_caching_success(client: TestClient, starter_project, crea
|
|||
assert "session_id" in data
|
||||
|
||||
|
||||
@pytest.mark.api_key_required
|
||||
def test_run_flow_with_caching_invalid_flow_id(client: TestClient, created_api_key):
|
||||
invalid_flow_id = uuid4()
|
||||
headers = {"x-api-key": created_api_key.api_key}
|
||||
|
|
@ -693,6 +695,7 @@ def test_run_flow_with_caching_invalid_flow_id(client: TestClient, created_api_k
|
|||
assert f"Flow identifier {invalid_flow_id} not found" in data["detail"]
|
||||
|
||||
|
||||
@pytest.mark.api_key_required
|
||||
def test_run_flow_with_caching_invalid_input_format(client: TestClient, starter_project, created_api_key):
|
||||
flow_id = starter_project["id"]
|
||||
headers = {"x-api-key": created_api_key.api_key}
|
||||
|
|
@ -701,6 +704,7 @@ def test_run_flow_with_caching_invalid_input_format(client: TestClient, starter_
|
|||
assert response.status_code == status.HTTP_422_UNPROCESSABLE_ENTITY
|
||||
|
||||
|
||||
@pytest.mark.api_key_required
|
||||
def test_run_flow_with_session_id(client, starter_project, created_api_key):
|
||||
headers = {"x-api-key": created_api_key.api_key}
|
||||
flow_id = starter_project["id"]
|
||||
|
|
@ -732,6 +736,7 @@ def test_run_flow_with_invalid_session_id(client, starter_project, created_api_k
|
|||
assert f"Session {payload['session_id']} not found" in data["detail"]
|
||||
|
||||
|
||||
@pytest.mark.api_key_required
|
||||
def test_run_flow_with_invalid_tweaks(client, starter_project, created_api_key):
|
||||
headers = {"x-api-key": created_api_key.api_key}
|
||||
flow_id = starter_project["id"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue