diff --git a/pymisp/api.py b/pymisp/api.py index 110ed61..a4cec6f 100644 --- a/pymisp/api.py +++ b/pymisp/api.py @@ -2226,7 +2226,7 @@ class PyMISP: return self._csv_to_dict(normalized_response_text) # type: ignore else: return normalized_response_text - elif return_format == 'stix-xml': + elif return_format in ['stix-xml', 'text']: return self._check_response(response) normalized_response = self._check_json_response(response) diff --git a/tests/testlive_comprehensive.py b/tests/testlive_comprehensive.py index 1478686..58068b4 100644 --- a/tests/testlive_comprehensive.py +++ b/tests/testlive_comprehensive.py @@ -1152,6 +1152,19 @@ class TestComprehensive(unittest.TestCase): self.admin_misp_connector.delete_event(first) self.admin_misp_connector.delete_event(second) + def test_search_text(self): + first = self.create_simple_event() + first.add_attribute('ip-src', '8.8.8.8') + first.publish() + try: + first = self.user_misp_connector.add_event(first) + self.admin_misp_connector.publish(first) + text = self.user_misp_connector.search(return_format='text', eventid=first.id) + self.assertEqual('8.8.8.8', text.strip()) + finally: + # Delete event + self.admin_misp_connector.delete_event(first) + def test_search_stix(self): first = self.create_simple_event() first.add_attribute('ip-src', '8.8.8.8')