From f133cb9477dab9cd81f8631db8c27af6c0d291c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Tue, 27 Aug 2019 10:43:58 +0200 Subject: [PATCH] chg: Re-enable a few test cases --- pymisp/aping.py | 2 +- tests/testlive_comprehensive.py | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/pymisp/aping.py b/pymisp/aping.py index c816bd8..5c236d7 100644 --- a/pymisp/aping.py +++ b/pymisp/aping.py @@ -421,7 +421,7 @@ class ExpandedPyMISP(PyMISP): response = self._prepare_request('POST', f'attributes/delete/{attribute_id}') response = self._check_response(response, expect_json=True) if ('errors' in response and response['errors'][0] == 403 - and response['errors'][1]['message'] == 'Attribute not found or not authorised.'): + and response['errors'][1]['message'] == 'You do not have permission to do that.'): # FIXME: https://github.com/MISP/MISP/issues/4913 # At this point, we assume the user tried to delete an attribute on an event they don't own # Re-try with a proposal diff --git a/tests/testlive_comprehensive.py b/tests/testlive_comprehensive.py index 2fcc11d..5529ec7 100644 --- a/tests/testlive_comprehensive.py +++ b/tests/testlive_comprehensive.py @@ -517,9 +517,8 @@ class TestComprehensive(unittest.TestCase): obj.add_attribute('filename', 'foo') first.add_object(obj) first = self.user_misp_connector.add_event(first) - # FIXME: https://github.com/MISP/MISP/issues/5060 - # r = self.user_misp_connector.delete_attribute(first.attributes[0].uuid) - # self.assertEqual(r['message'], 'Attribute deleted.') + r = self.user_misp_connector.delete_attribute(first.attributes[0].uuid) + self.assertEqual(r['message'], 'Attribute deleted.') r = self.user_misp_connector.delete_object(first.objects[0].uuid) self.assertEqual(r['message'], 'Object deleted') r = self.user_misp_connector.delete_event(first.uuid) @@ -1491,9 +1490,8 @@ class TestComprehensive(unittest.TestCase): self.assertTrue(isinstance(attribute, MISPShadowAttribute), attribute) self.assertEqual(attribute.value, second.attributes[0].value) # Delete attribute owned by someone else - # FIXME: https://github.com/MISP/MISP/issues/5060 - # response = self.user_misp_connector.delete_attribute(second.attributes[1]) - # self.assertTrue(response['success']) + response = self.user_misp_connector.delete_attribute(second.attributes[1]) + self.assertTrue(response['success']) # Delete attribute owned by user response = self.admin_misp_connector.delete_attribute(second.attributes[1]) self.assertEqual(response['message'], 'Attribute deleted.') @@ -1603,7 +1601,7 @@ class TestComprehensive(unittest.TestCase): self.assertEqual(list(users_stats.keys()), ['flatData', 'treemap']) users_stats = self.admin_misp_connector.users_statistics(context='attributehistogram') - self.assertTrue(isinstance(users_stats, dict), users_stats) + self.assertTrue(isinstance(users_stats, list), users_stats) self.user_misp_connector.add_sighting({'value': first.attributes[0].value}) users_stats = self.user_misp_connector.users_statistics(context='sightings')