File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11"""Tests for the SDK client."""
22
3- from unittest .mock import AsyncMock , MagicMock , patch
3+ from unittest .mock import AsyncMock , MagicMock
44
55import pytest
66
@@ -49,10 +49,10 @@ def test_sync_sdk_initialization() -> None:
4949
5050
5151def 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
5858def test_custom_endpoints () -> None :
Original file line number Diff line number Diff line change 55
66def 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
You can’t perform that action at this time.
0 commit comments