Skip to content

Commit

Permalink
Add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
abhahn committed May 25, 2024
1 parent 370edb1 commit a31674d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ AZURE_OPENAI_STREAM=False
AZURE_OPENAI_ENDPOINT=https://dummy.openai.azure.com/
AZURE_OPENAI_EMBEDDING_NAME=
AZURE_OPENAI_EMBEDDING_ENDPOINT=
AZURE_OPENAI_EMBEDDING_KEY=
AZURE_OPENAI_EMBEDDING_KEY=
14 changes: 14 additions & 0 deletions tests/unit_tests/dotenv_no_datasource_2
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
AZURE_OPENAI_MODEL=my_model
AZURE_OPENAI_KEY=dummy
AZURE_OPENAI_TEMPERATURE=0
AZURE_OPENAI_TOP_P=1.0
AZURE_OPENAI_MAX_TOKENS=1000
AZURE_OPENAI_STOP_SEQUENCE=
AZURE_OPENAI_SYSTEM_MESSAGE=You are an AI assistant that helps people find information.
AZURE_OPENAI_PREVIEW_API_VERSION=2024-05-01-preview
AZURE_OPENAI_STREAM=False
AZURE_OPENAI_ENDPOINT=https://dummy.openai.azure.com/
AZURE_OPENAI_EMBEDDING_NAME=
AZURE_OPENAI_EMBEDDING_ENDPOINT=
AZURE_OPENAI_EMBEDDING_KEY=
DATASOURCE_TYPE=AzureCognitiveSearch
8 changes: 7 additions & 1 deletion tests/unit_tests/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,17 @@ def app_settings(dotenv_path):
yield getattr(settings_module, "app_settings")


def test_dotenv_no_datasource(app_settings):
def test_dotenv_no_datasource_1(app_settings):
# Validate model object
assert app_settings.base_settings.datasource_type is None
assert app_settings.datasource is None
assert app_settings.azure_openai is not None


def test_dotenv_no_datasource_2(app_settings):
# Validate model object
assert app_settings.datasource is None
assert app_settings.azure_openai is not None


def test_dotenv_with_azure_search_success(app_settings):
Expand Down

0 comments on commit a31674d

Please sign in to comment.