mirror of
https://github.com/hanzoai/python-sdk.git
synced 2026-10-23 20:23:00 +00:00
fix: Test client initialization with explicit API key
The test_client_initialization test was failing in CI because it tried to create a Hanzo() client without an API key. Fixed by: - Providing a dummy test API key for unit testing (tests instantiation) - Adding separate test for env-based initialization that's skipped when HANZO_API_KEY is not set
This commit is contained in:
+14
-1
@@ -73,7 +73,20 @@ class TestBasicClient:
|
||||
"""Test basic Hanzo client functionality."""
|
||||
|
||||
def test_client_initialization(self):
|
||||
"""Test client can be initialized."""
|
||||
"""Test client can be initialized with API key."""
|
||||
from hanzoai import Hanzo
|
||||
|
||||
# Use a dummy API key for testing - this only tests client instantiation
|
||||
# not actual API connectivity
|
||||
client = Hanzo(api_key="test-api-key-for-unit-tests")
|
||||
assert client is not None
|
||||
|
||||
@pytest.mark.skipif(
|
||||
not os.environ.get("HANZO_API_KEY"),
|
||||
reason="HANZO_API_KEY not set"
|
||||
)
|
||||
def test_client_initialization_from_env(self):
|
||||
"""Test client can be initialized from environment."""
|
||||
from hanzoai import Hanzo
|
||||
|
||||
client = Hanzo()
|
||||
|
||||
Reference in New Issue
Block a user