mirror of
https://github.com/khoj-ai/khoj
synced 2026-04-21 07:57:15 +00:00
Skip automation tests when GEMINI_API_KEY is not set
- Add missing skipif decorator to test_create_automation - Change skip condition from 'is None' to 'not' (falsy check) to also handle empty string, which happens when GitHub secrets are unavailable in fork PRs
This commit is contained in:
parent
7264ebf533
commit
51a56af7ca
1 changed files with 5 additions and 4 deletions
|
|
@ -32,6 +32,7 @@ def create_test_automation(client: TestClient) -> str:
|
|||
|
||||
|
||||
@pytest.mark.django_db(transaction=True)
|
||||
@pytest.mark.skipif(not get_chat_api_key("google"), reason="Requires GEMINI_API_KEY to be set")
|
||||
def test_create_automation(client: TestClient):
|
||||
"""Test that creating an automation works as expected."""
|
||||
# Arrange
|
||||
|
|
@ -55,7 +56,7 @@ def test_create_automation(client: TestClient):
|
|||
|
||||
|
||||
@pytest.mark.django_db(transaction=True)
|
||||
@pytest.mark.skipif(get_chat_api_key("google") is None, reason="Requires GEMINI_API_KEY to be set")
|
||||
@pytest.mark.skipif(not get_chat_api_key("google"), reason="Requires GEMINI_API_KEY to be set")
|
||||
def test_get_automations(client: TestClient):
|
||||
"""Test that getting a list of automations works."""
|
||||
automation_id = create_test_automation(client)
|
||||
|
|
@ -72,7 +73,7 @@ def test_get_automations(client: TestClient):
|
|||
|
||||
|
||||
@pytest.mark.django_db(transaction=True)
|
||||
@pytest.mark.skipif(get_chat_api_key("google") is None, reason="Requires GEMINI_API_KEY to be set")
|
||||
@pytest.mark.skipif(not get_chat_api_key("google"), reason="Requires GEMINI_API_KEY to be set")
|
||||
def test_delete_automation(client: TestClient):
|
||||
"""Test that deleting an automation works."""
|
||||
automation_id = create_test_automation(client)
|
||||
|
|
@ -91,7 +92,7 @@ def test_delete_automation(client: TestClient):
|
|||
|
||||
|
||||
@pytest.mark.django_db(transaction=True)
|
||||
@pytest.mark.skipif(get_chat_api_key("google") is None, reason="Requires GEMINI_API_KEY to be set")
|
||||
@pytest.mark.skipif(not get_chat_api_key("google"), reason="Requires GEMINI_API_KEY to be set")
|
||||
def test_edit_automation(client: TestClient):
|
||||
"""Test that editing an automation works."""
|
||||
automation_id = create_test_automation(client)
|
||||
|
|
@ -118,7 +119,7 @@ def test_edit_automation(client: TestClient):
|
|||
|
||||
|
||||
@pytest.mark.django_db(transaction=True)
|
||||
@pytest.mark.skipif(get_chat_api_key("google") is None, reason="Requires GEMINI_API_KEY to be set")
|
||||
@pytest.mark.skipif(not get_chat_api_key("google"), reason="Requires GEMINI_API_KEY to be set")
|
||||
def test_trigger_automation(client: TestClient):
|
||||
"""Test that triggering an automation works."""
|
||||
automation_id = create_test_automation(client)
|
||||
|
|
|
|||
Loading…
Reference in a new issue