-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: refactor and add components integration tests (#3607)
* improve inegration tests * add fixes * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
4ee2535
commit 96872f3
Showing
32 changed files
with
528 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import os.path | ||
|
||
# we need to import tmpdir | ||
|
||
|
||
def get_required_env_var(var: str) -> str: | ||
""" | ||
Get the value of the specified environment variable. | ||
Args: | ||
var (str): The environment variable to get. | ||
Returns: | ||
str: The value of the environment variable. | ||
Raises: | ||
ValueError: If the environment variable is not set. | ||
""" | ||
value = os.getenv(var) | ||
if not value: | ||
raise ValueError(f"Environment variable {var} is not set") | ||
return value | ||
|
||
|
||
def get_openai_api_key() -> str: | ||
return get_required_env_var("OPENAI_API_KEY") | ||
|
||
|
||
def get_astradb_application_token() -> str: | ||
return get_required_env_var("ASTRA_DB_APPLICATION_TOKEN") | ||
|
||
|
||
def get_astradb_api_endpoint() -> str: | ||
return get_required_env_var("ASTRA_DB_API_ENDPOINT") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/backend/tests/integration/backward_compatibility/test_starter_projects.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import pytest | ||
from langflow.schema.message import Message | ||
from tests.api_keys import get_openai_api_key | ||
from tests.integration.utils import download_flow_from_github, run_json_flow | ||
|
||
|
||
@pytest.mark.asyncio | ||
@pytest.mark.api_key_required | ||
async def test_1_0_15_basic_prompting(): | ||
api_key = get_openai_api_key() | ||
json_flow = download_flow_from_github("Basic Prompting (Hello, World)", "1.0.15") | ||
json_flow.set_value(json_flow.get_component_by_type("OpenAIModel"), "api_key", api_key) | ||
outputs = await run_json_flow(json_flow, run_input="my name is bob, say hello!") | ||
assert isinstance(outputs["message"], Message) | ||
response = outputs["message"].text.lower() | ||
assert "arr" in response or "ahoy" in response |
Empty file.
Oops, something went wrong.