"""Unit tests for Setlive workflow.""" from unittest import mock from unittest.mock import MagicMock from feed_ingestion.flows.setlive.flow import Flow def test_decider(): """Test normal decider execution.""" schedule = MagicMock() bootstrap_mock = MagicMock() bootstrap_mock.result.get.side_effect = lambda key: ( False if key == 'bootstrap.stop' else None ) check_files_on_s3_mock = MagicMock() check_files_on_s3_mock.result.get.side_effect = lambda key: ( False if key == 'check_files_on_s3.stop' else None ) schedule.side_effect = [ bootstrap_mock, check_files_on_s3_mock, MagicMock(), MagicMock(), ] flow = Flow() flow.decider(schedule) schedule.assert_has_calls([ mock.call('bootstrap', mock.ANY), mock.call('check_files_on_s3', mock.ANY, requires=mock.ANY), mock.call('load_staging_raw_table', mock.ANY, requires=mock.ANY), mock.call('mark_ingested_files', mock.ANY, requires=mock.ANY), ])