From 14e63d9ca8b6d879d5040b4dda83d380336f7828 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Fri, 19 Jul 2019 10:57:15 +0200 Subject: [PATCH] new: [tests] non-exportable tags --- tests/testlive_comprehensive.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/testlive_comprehensive.py b/tests/testlive_comprehensive.py index ec80eed..5b359c3 100644 --- a/tests/testlive_comprehensive.py +++ b/tests/testlive_comprehensive.py @@ -1079,9 +1079,29 @@ class TestComprehensive(unittest.TestCase): tag.name = 'this is a test tag' new_tag = self.admin_misp_connector.add_tag(tag, pythonify=True) self.assertEqual(new_tag.name, tag.name) + # Add non-exportable tag + tag = MISPTag() + tag.name = 'non-exportable tag' + tag.exportable = False + non_exportable_tag = self.admin_misp_connector.add_tag(tag, pythonify=True) + self.assertFalse(non_exportable_tag.exportable) + first = self.create_simple_event() + first.attributes[0].add_tag('non-exportable tag') + try: + first = self.user_misp_connector.add_event(first, pythonify=True) + self.assertFalse(first.attributes[0].tags) + first = self.admin_misp_connector.get_event(first, pythonify=True) + # Reference: https://github.com/MISP/MISP/issues/1394 + self.assertFalse(first.attributes[0].tags) + finally: + # Delete event + self.admin_misp_connector.delete_event(first.id) + # Delete tag response = self.admin_misp_connector.delete_tag(new_tag.id) self.assertEqual(response['message'], 'Tag deleted.') + response = self.admin_misp_connector.delete_tag(non_exportable_tag.id) + self.assertEqual(response['message'], 'Tag deleted.') def test_add_event_with_attachment_object_controller(self): first = self.create_simple_event()