def test_clean_json_linkedIssues_ConnectionError_real_data(self) -> None: with patch('base_class.requests') as mock_requests: from test_extraction_V2 import TestExtractor, NAME from deployment_log_UAT import DeployExtractor from barros_request import BarrosExtractor dic = dict() dic['T2L-249'] = grab_tickets_json['T2L-249'] mock_requests.get.side_effect = [ ConnectionError, ConnectionError, ConnectionError, ConnectionError, ConnectionError, ConnectionError ] with self.assertRaises( ConnectionError ): # testing 2 linked tickets so the asynchronous call is triggered TestExtractor(NAME, False).clean_json(dic) with self.assertRaises( ConnectionError ): # testing 2 linked tickets so the asynchronous call is triggered DeployExtractor(NAME, False).clean_json(dic) with self.assertRaises( ConnectionError ): # testing 2 linked tickets so the asynchronous call is triggered BarrosExtractor(NAME, False).clean_json(dic) configuration = Loader.grab_configuration(self) creds = f"Basic {configuration.u}" mock_requests.assert_has_calls([ call.get(self.TEST_call_2, headers={ 'Authorization': creds, 'Content-Type': 'application/json' }, verify=False) ])
def test_clean_json_patch_ConnectionError(self) -> None: with patch('jira_routine_V2.requests') as mock_requests: from jira_routine_V2 import LogExtractor, NAME dic = dict() dic['T2L-249'] = grab_tickets_json['T2L-249'] mock_requests.get.side_effect = [ ConnectionError, ConnectionError, ConnectionError, ConnectionError, ConnectionError, ConnectionError ] with self.assertRaises(ConnectionError): LogExtractor(NAME, False).clean_json(dic) configuration = Loader.grab_configuration(self) creds = f"Basic {configuration.u}" mock_requests.assert_has_calls([ call.get(self.TEST_call_1, headers={ 'Authorization': creds, 'Content-Type': 'application/json' }, verify=False) ])