Skip to content

Commit 105f260

Browse files
committed
Updating tests
1 parent d211082 commit 105f260

2 files changed

Lines changed: 18 additions & 11 deletions

File tree

tests/test_client.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Tests for the SDK client."""
22

3-
from unittest.mock import AsyncMock, MagicMock, patch
3+
from unittest.mock import AsyncMock, MagicMock
44

55
import pytest
66

@@ -49,10 +49,10 @@ def test_sync_sdk_initialization() -> None:
4949

5050

5151
def test_sdk_requires_secret() -> None:
52-
"""Test that SDK requires a secret."""
53-
with patch.dict("os.environ", {}, clear=True):
54-
with pytest.raises(ValueError, match="Agent secret must be provided"):
55-
AsyncValueClient(secret="")
52+
"""Test that SDK requires a secret (positional argument)."""
53+
# secret is now a required positional argument, so calling without it raises TypeError
54+
with pytest.raises(TypeError):
55+
AsyncValueClient() # type: ignore
5656

5757

5858
def test_custom_endpoints() -> None:

tests/test_config.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,21 @@
55

66
def test_config_with_defaults() -> None:
77
"""Test config with default values."""
8-
config = SDKConfig(secret="test-secret")
9-
assert config.secret == "test-secret"
8+
config = SDKConfig()
109
assert config.otel_endpoint == "http://localhost:4317"
1110
assert config.service_name == "value-control-agent"
1211
assert config.enable_console_export is False
1312

1413

15-
def test_config_allows_empty_secret() -> None:
16-
"""Test that config allows empty secret (validation is done in client)."""
17-
config = SDKConfig(secret="")
18-
assert config.secret == ""
14+
def test_config_custom_values() -> None:
15+
"""Test config with custom values."""
16+
config = SDKConfig(
17+
otel_endpoint="http://custom:4317",
18+
backend_url="https://custom.api",
19+
service_name="my-service",
20+
enable_console_export=True,
21+
)
22+
assert config.otel_endpoint == "http://custom:4317"
23+
assert config.backend_url == "https://custom.api"
24+
assert config.service_name == "my-service"
25+
assert config.enable_console_export is True

0 commit comments

Comments
 (0)