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>
This commit is contained in:
parent
4ee25359a5
commit
96872f3aa5
32 changed files with 523 additions and 131 deletions
34
src/backend/tests/api_keys.py
Normal file
34
src/backend/tests/api_keys.py
Normal file
|
|
@ -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")
|
||||
Loading…
Add table
Add a link
Reference in a new issue