@@ -1911,7 +1911,14 @@ def test_lambda_client_initialize_from_env_default(mock_boto_client):
19111911 with patch .object (LambdaClient , "load_preview_botocore_models" ):
19121912 client = LambdaClient .initialize_from_env ()
19131913
1914- mock_boto_client .assert_called_with ("lambdainternal" )
1914+ # Check that boto3.client was called with the right service name and config
1915+ mock_boto_client .assert_called_once ()
1916+ call_args = mock_boto_client .call_args
1917+ assert call_args [0 ][0 ] == "lambdainternal"
1918+ assert "config" in call_args [1 ]
1919+ config = call_args [1 ]["config" ]
1920+ assert config .connect_timeout == 5
1921+ assert config .read_timeout == 50
19151922 assert isinstance (client , LambdaClient )
19161923
19171924
@@ -1925,9 +1932,15 @@ def test_lambda_client_initialize_from_env_with_endpoint(mock_boto_client):
19251932 with patch .object (LambdaClient , "load_preview_botocore_models" ):
19261933 client = LambdaClient .initialize_from_env ()
19271934
1928- mock_boto_client .assert_called_with (
1929- "lambdainternal" , endpoint_url = "http://localhost:3000"
1930- )
1935+ # Check that boto3.client was called with the right parameters and config
1936+ mock_boto_client .assert_called_once ()
1937+ call_args = mock_boto_client .call_args
1938+ assert call_args [0 ][0 ] == "lambdainternal"
1939+ assert call_args [1 ]["endpoint_url" ] == "http://localhost:3000"
1940+ assert "config" in call_args [1 ]
1941+ config = call_args [1 ]["config" ]
1942+ assert config .connect_timeout == 5
1943+ assert config .read_timeout == 50
19311944 assert isinstance (client , LambdaClient )
19321945
19331946
@@ -1939,11 +1952,16 @@ def test_lambda_client_initialize_local_runner_client(mock_boto3):
19391952
19401953 lambda_client = LambdaClient .initialize_local_runner_client ()
19411954
1942- mock_boto3 .client .assert_called_once_with (
1943- "lambdainternal-local" ,
1944- endpoint_url = "http://host.docker.internal:5000" ,
1945- region_name = "us-west-2" ,
1946- )
1955+ # Check that boto3.client was called with the right parameters and config
1956+ mock_boto3 .client .assert_called_once ()
1957+ call_args = mock_boto3 .client .call_args
1958+ assert call_args [0 ][0 ] == "lambdainternal-local"
1959+ assert call_args [1 ]["endpoint_url" ] == "http://host.docker.internal:5000"
1960+ assert call_args [1 ]["region_name" ] == "us-west-2"
1961+ assert "config" in call_args [1 ]
1962+ config = call_args [1 ]["config" ]
1963+ assert config .connect_timeout == 5
1964+ assert config .read_timeout == 50
19471965 assert lambda_client .client == mock_client
19481966
19491967
@@ -1988,11 +2006,12 @@ def test_lambda_client_initialize_local_runner_client_defaults(mock_boto3):
19882006
19892007 lambda_client = LambdaClient .initialize_local_runner_client ()
19902008
1991- mock_boto3 .client .assert_called_once_with (
1992- "lambdainternal-local" ,
1993- endpoint_url = "http://host.docker.internal:5000" ,
1994- region_name = "us-west-2" ,
1995- )
2009+ # Verify the call was made with the expected arguments including config
2010+ call_args = mock_boto3 .client .call_args
2011+ assert call_args [0 ] == ("lambdainternal-local" ,)
2012+ assert call_args [1 ]["endpoint_url" ] == "http://host.docker.internal:5000"
2013+ assert call_args [1 ]["region_name" ] == "us-west-2"
2014+ assert "config" in call_args [1 ]
19962015 assert lambda_client .client == mock_client
19972016
19982017
@@ -2040,7 +2059,10 @@ def test_lambda_client_initialize_from_env_no_endpoint(mock_boto_client):
20402059 with patch .object (LambdaClient , "load_preview_botocore_models" ):
20412060 client = LambdaClient .initialize_from_env ()
20422061
2043- mock_boto_client .assert_called_with ("lambdainternal" )
2062+ # Verify the call was made with the expected arguments including config
2063+ call_args = mock_boto_client .call_args
2064+ assert call_args [0 ] == ("lambdainternal" ,)
2065+ assert "config" in call_args [1 ]
20442066 assert isinstance (client , LambdaClient )
20452067
20462068
0 commit comments