diff --git a/Packs/ReversingLabs_A1000/Integrations/ReversingLabsA1000v2/ReversingLabsA1000v2.py b/Packs/ReversingLabs_A1000/Integrations/ReversingLabsA1000v2/ReversingLabsA1000v2.py index ceb763c3c276..cf05546ae7f1 100644 --- a/Packs/ReversingLabs_A1000/Integrations/ReversingLabsA1000v2/ReversingLabsA1000v2.py +++ b/Packs/ReversingLabs_A1000/Integrations/ReversingLabsA1000v2/ReversingLabsA1000v2.py @@ -1,3 +1,5 @@ +import json + from CommonServerPython import * from ReversingLabs.SDK.a1000 import A1000 @@ -220,6 +222,11 @@ def upload_sample(a1000): except Exception as e: return_error(str(e)) + results, file_result = upload_sample_output(response_json=response_json) + return [results, file_result] + + +def upload_sample_output(response_json): markdown = f'''## ReversingLabs A1000 upload sample\n **Message:** {response_json.get('message')} **ID:** {demisto.get(response_json, 'detail.id')} **SHA1:** {demisto.get(response_json, 'detail.sha1')} @@ -234,7 +241,7 @@ def upload_sample(a1000): file_result = fileResult('Upload sample report file', json.dumps(response_json, indent=4), file_type=EntryType.ENTRY_INFO_FILE) - return [command_result, file_result] + return command_result, file_result def delete_sample(a1000): diff --git a/Packs/ReversingLabs_A1000/Integrations/ReversingLabsA1000v2/ReversingLabsA1000v2_test.py b/Packs/ReversingLabs_A1000/Integrations/ReversingLabsA1000v2/ReversingLabsA1000v2_test.py index cfdd8080e31e..8dd493a354fe 100644 --- a/Packs/ReversingLabs_A1000/Integrations/ReversingLabsA1000v2/ReversingLabsA1000v2_test.py +++ b/Packs/ReversingLabs_A1000/Integrations/ReversingLabsA1000v2/ReversingLabsA1000v2_test.py @@ -3,7 +3,7 @@ classification_to_score, url_report_output, domain_report_output, ip_report_output, format_proxy, \ file_analysis_status_output, pdf_report_output, static_analysis_report_output, dynamic_analysis_report_output, \ sample_classification_output, yara_output, yara_retro_output, list_containers_output, upload_from_url_output, \ - delete_sample_output, reanalyze_output, advanced_search_output, VERSION, USER_AGENT, RELIABILITY, return_proxies + delete_sample_output, reanalyze_output, advanced_search_output, VERSION, USER_AGENT, RELIABILITY, upload_sample_output import demistomock as demisto import pytest @@ -214,6 +214,13 @@ def test_vars(): assert RELIABILITY is not None +def test_upload_sample_output(): + report = util_load_json("test_data/a1000_upload_sample.json") + result = upload_sample_output(response_json=report) + + assert result[0].to_context().get("Contents").get("a1000_upload_report").get("message") == "Done." + + def util_load_json(path): with open(path, mode='r') as f: return json.loads(f.read()) diff --git a/Packs/ReversingLabs_A1000/Integrations/ReversingLabsA1000v2/test_data/a1000_upload_sample.json b/Packs/ReversingLabs_A1000/Integrations/ReversingLabsA1000v2/test_data/a1000_upload_sample.json new file mode 100644 index 000000000000..08ea6abe74b6 --- /dev/null +++ b/Packs/ReversingLabs_A1000/Integrations/ReversingLabsA1000v2/test_data/a1000_upload_sample.json @@ -0,0 +1 @@ +{"code": 201, "message": "Done.", "detail": {"id": 429, "sha1": "b8957f0ee3b7d8224d2b09358083da6f23dcb983", "user": 1, "created": "2024-06-11T15:57:18.933215Z", "filename": "url-cloud.json", "href": "/?q=b8957f0ee3b7d8224d2b09358083da6f23dcb983"}} \ No newline at end of file