From a3108f76896111e39b0e4e2688c3652ba29f566d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Wed, 26 Dec 2018 17:38:19 +0100 Subject: [PATCH] fix: error vs errors key --- pymisp/aping.py | 4 ++-- tests/testlive_comprehensive.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pymisp/aping.py b/pymisp/aping.py index 88d8a6b..097b8f9 100644 --- a/pymisp/aping.py +++ b/pymisp/aping.py @@ -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): diff --git a/tests/testlive_comprehensive.py b/tests/testlive_comprehensive.py index d7837ea..09ceb58 100644 --- a/tests/testlive_comprehensive.py +++ b/tests/testlive_comprehensive.py @@ -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