Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ def process_message(self) -> None:
self.helper.send_stix2_bundle(
stix_bundle,
work_id=work_id,
update=True,
cleanup_inconsistent_bundle=True,
)
self.helper.log_info("[CONNECTOR] STIX bundle sent successfully")
Expand Down
24 changes: 24 additions & 0 deletions external-import/harfanglab-incidents/tests/test_connector.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from datetime import datetime, timezone
from unittest.mock import Mock

from harfanglab_incidents_connector.connector import HarfanglabIncidentsConnector


def test_process_message_sends_bundle_with_update_flag() -> None:
connector = HarfanglabIncidentsConnector.__new__(HarfanglabIncidentsConnector)
connector.helper = Mock()
connector.helper.connect_name = "harfanglab-incidents"
connector.last_import_datetime_value = datetime.now(tz=timezone.utc)
connector._initiate_work = Mock(return_value="work-id")
connector.create_stix_bundle = Mock(return_value="bundle")
connector._set_state_last_datetime = Mock()
connector._terminate_work = Mock()

connector.process_message()

connector.helper.send_stix2_bundle.assert_called_once_with(
"bundle",
work_id="work-id",
update=True,
cleanup_inconsistent_bundle=True,
)