@@ -917,27 +917,17 @@ def test_exec_curl_cmd_no_http_status_code(self, mock_popen):
917917 @mock .patch ('subprocess.Popen' )
918918 def test_exec_curl_cmd_curl_error (self , mock_popen ):
919919 """Test exec_curl_cmd with curl error"""
920- side_effects = []
921-
922920 output = (load_redfish_response ('mock_bmc_login_token_response' ), b'' )
923921 mock_process = mock .Mock ()
924922 mock_process .communicate .return_value = output
925923 mock_process .returncode = 0
926- side_effects .append (mock_process )
927924
928925 output_error = (b'' , b'curl: (28) Operation timed out' )
929926 mock_process2 = mock .Mock ()
930927 mock_process2 .communicate .return_value = output_error
931928 mock_process2 .returncode = 28
932- side_effects .append (mock_process2 )
933-
934- logout_output = (b'HTTP Status Code: 200' , b'' )
935- mock_process3 = mock .Mock ()
936- mock_process3 .communicate .return_value = logout_output
937- mock_process3 .returncode = 0
938- side_effects .append (mock_process3 )
939929
940- mock_popen .side_effect = side_effects
930+ mock_popen .side_effect = [ mock_process , mock_process2 ]
941931
942932 rf = RedfishClient (TestRedfishClient .CURL_PATH ,
943933 TestRedfishClient .BMC_INTERNAL_IP_ADDR ,
@@ -946,7 +936,8 @@ def test_exec_curl_cmd_curl_error(self, mock_popen):
946936
947937 rf .login ()
948938 cmd = '/usr/bin/curl -k https://169.254.0.1/test'
949- ret , http_code , output , error = rf .exec_curl_cmd (cmd )
939+
940+ ret , http_code , output , error = rf ._RedfishClient__exec_curl_cmd_internal (cmd )
950941
951942 assert ret == RedfishClient .ERR_CODE_TIMEOUT
952943
@@ -1048,10 +1039,13 @@ def test_wait_task_completion_task_aborted(self, mock_popen):
10481039 @mock .patch ('time.sleep' )
10491040 def test_wait_task_completion_timeout (self , mock_sleep , mock_time , mock_popen ):
10501041 """Test __wait_task_completion with timeout"""
1042+ side_effects = []
1043+
10511044 output = (load_redfish_response ('mock_bmc_login_token_response' ), b'' )
10521045 mock_process = mock .Mock ()
10531046 mock_process .communicate .return_value = output
10541047 mock_process .returncode = 0
1048+ side_effects .append (mock_process )
10551049
10561050 task_response = json .dumps ({
10571051 "PercentComplete" : 50 ,
@@ -1062,10 +1056,11 @@ def test_wait_task_completion_timeout(self, mock_sleep, mock_time, mock_popen):
10621056 mock_process2 = mock .Mock ()
10631057 mock_process2 .communicate .return_value = output_task
10641058 mock_process2 .returncode = 0
1059+ side_effects .append (mock_process2 )
1060+
1061+ mock_time .side_effect = [100 , 110 ]
10651062
1066- mock_time .side_effect = [100 , 100 , 110 ]
1067-
1068- mock_popen .side_effect = [mock_process , mock_process2 ]
1063+ mock_popen .side_effect = side_effects
10691064
10701065 rf = RedfishClient (TestRedfishClient .CURL_PATH ,
10711066 TestRedfishClient .BMC_INTERNAL_IP_ADDR ,
0 commit comments