@@ -233,23 +233,12 @@ def test_sse_server_info_with_token_secret_cannot_serialize(self):
233233 )
234234
235235 # Token-based secrets cannot be serialized
236- with pytest .raises (ValueError , match = "Cannot serialize token-based secret " ):
236+ with pytest .raises (ValueError , match = "token" ):
237237 server_info .to_dict ()
238238
239- def test_streamable_http_server_info_with_token_secret_cannot_serialize (self ):
240- """Test that StreamableHttpServerInfo with Secret.from_token cannot be serialized."""
241- server_info = StreamableHttpServerInfo (
242- url = "https://localhost:8000/streamable" ,
243- token = Secret .from_token ("secret_token_value" ),
244- )
245-
246- # Token-based secrets cannot be serialized
247- with pytest .raises (ValueError , match = "Cannot serialize token-based secret" ):
248- server_info .to_dict ()
249-
250- def test_secret_deserialization_handles_any_secret_type (self ):
239+ def test_secret_deserialization_handles_any_secret_type (self , monkeypatch ):
251240 """Test that our deserialization can handle any Secret type, not just env_vars."""
252- # Simulate a serialized Secret with just "type" field (like a hypothetical future Secret type )
241+ monkeypatch . setenv ( "TEST_VAR" , "test_var_value" )
253242 fake_secret_dict = {"type" : "env_var" , "env_vars" : ["TEST_VAR" ], "strict" : True } # Valid Secret type
254243
255244 server_info_dict = {
@@ -263,6 +252,7 @@ def test_secret_deserialization_handles_any_secret_type(self):
263252 # This should work - our condition only checks for "type" field
264253 deserialized = SSEServerInfo .from_dict (server_info_dict )
265254 assert isinstance (deserialized .token , Secret )
255+ assert deserialized .token .resolve_value () == "test_var_value"
266256 assert deserialized .url == "https://localhost:8000/sse"
267257
268258 def test_non_secret_dict_with_type_field_not_deserialized (self ):
0 commit comments