@@ -12,15 +12,6 @@ class ErrorHandleTest(SDKTestBase):
1212
1313 # TODO make these test stronger with a mock server
1414
15- def _parse_complex_error_message (self , error_message ):
16- obj = dict ()
17- lines = error_message .split ('\n ' )
18- head_message = lines [0 ].strip ()
19- for line in lines [1 :]:
20- key , value = line .strip ().split (':' , 1 )
21- obj [key .strip ()] = value .strip ()
22- return head_message , obj
23-
2415 def test_server_timeout (self ):
2516 acs_client = AcsClient (self .access_key_id , self .access_key_secret ,
2617 "cn-hangzhou" , timeout = 0.001 )
@@ -34,8 +25,8 @@ def test_server_timeout(self):
3425 assert False
3526 except ClientException as e :
3627 self .assertEqual ("SDK.HttpError" , e .error_code )
37- head_message , attributes = self ._parse_complex_error_message ( e . get_error_msg ())
38- self . assertEqual ( "ecs-cn-hangzhou.aliyuncs.com " , attributes . get ( "Endpoint" ))
28+ self .assertEqual ( "HTTPConnectionPool(host='ecs-cn-hangzhou.aliyuncs.com',"
29+ " port=80): Read timed out. (read timeout=0.001) " , e . get_error_msg ( ))
3930
4031 def test_server_unreachable (self ):
4132 from aliyunsdkcore .request import CommonRequest
@@ -46,8 +37,8 @@ def test_server_unreachable(self):
4637 assert False
4738 except ClientException as e :
4839 self .assertEqual ("SDK.HttpError" , e .error_code )
49- head_message , attributes = self ._parse_complex_error_message (e .get_error_msg ())
50- self . assertEqual ( "www.aliyun-hangzhou.com" , attributes . get ( "Endpoint " ))
40+ self .assertTrue (e .get_error_msg (). startswith ( "HTTPConnectionPool(host='www.aliyun-hangzhou.com',"
41+ " port=80): Max retries exceeded with url: " ))
5142
5243 def test_server_error_normal (self ):
5344 from aliyunsdkecs .request .v20140526 .DeleteInstanceRequest import DeleteInstanceRequest
0 commit comments