def test_with_handler(self, mocker, pipeline, twin_patch): # Set the handler mock_handler = mocker.MagicMock() pipeline.on_twin_patch_received = mock_handler assert mock_handler.call_count == 0 # Create the event twin_patch_event = pipeline_events_iothub.TwinDesiredPropertiesPatchEvent(twin_patch) # Trigger the event pipeline._pipeline.on_pipeline_event_handler(twin_patch_event) assert mock_handler.call_count == 1 assert mock_handler.call_args == mocker.call(twin_patch)
def test_no_handler(self, pipeline, twin_patch): twin_patch_event = pipeline_events_iothub.TwinDesiredPropertiesPatchEvent( twin_patch) pipeline._pipeline.on_pipeline_event_handler(twin_patch_event)
def event(self, version): return pipeline_events_iothub.TwinDesiredPropertiesPatchEvent(patch={"$version": version})