fix: error vs errors key

pull/325/head
Raphaël Vinot 2018-12-26 17:38:19 +01:00
parent 10ccd637d9
commit a3108f7689
2 changed files with 3 additions and 3 deletions

View File

@ -69,7 +69,7 @@ class ExpandedPyMISP(PyMISP):
# The server returns a json message with the error details
error_message = response.json()
logger.error(f'Something went wrong ({response.status_code}): {error_message}')
return {'error': (response.status_code, error_message)}
return {'errors': (response.status_code, error_message)}
# At this point, we had no error.
@ -87,7 +87,7 @@ class ExpandedPyMISP(PyMISP):
if not len(response.content):
# Empty response
logger.error('Got an empty response.')
return {'error': 'The response is empty.'}
return {'errors': 'The response is empty.'}
return response.text
def get_event(self, event_id: int):

View File

@ -755,7 +755,7 @@ class TestComprehensive(unittest.TestCase):
second = self.user_misp_connector.add_event(second)
response = self.user_misp_connector.fast_publish(first.id, alert=False)
self.assertEqual(response['errors'][0][1]['message'], 'You do not have permission to use this functionality.')
self.assertEqual(response['errors'][1]['message'], 'You do not have permission to use this functionality.')
# Default search, attribute with to_ids == True
first.attributes[0].to_ids = True