fix: support text search again

Fix #705
obj_break_on_duplicates
Raphaël Vinot 2021-02-26 17:13:16 +01:00
parent 6395951637
commit cdcbe9bf32
2 changed files with 14 additions and 1 deletions

View File

@ -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)

View File

@ -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')