"""Unit tests for tasks of Store Specific Spotify Strikes Workflow.""" from unittest.mock import MagicMock import pytest from feed_ingestion.flows.spotify_strikes import config from feed_ingestion.flows.spotify_strikes import tasks @pytest.fixture def context(): """Context for Store Specific Spotify Strikes tasks.""" return {'activity': MagicMock()} @pytest.fixture def expected_bootstrap_response(context): """Response for bootstrap task.""" return { 'strikes_sheet_id': '1w0h-ZVtlxb_GDb9BVvfehHQvYB6HpGxOG4tJfCoC69k', 'snowflake_file_format_tsv': 'dev.test.TSV_HEAD', 's3_path': ( 's3://dev-cucumbers/etl/store/' 'spotify/hides_and_strikes/strikes.tsv'), 'email_list': [ 'leon@theorchard.com', 'datarequests@theorchard.com'], 'strikes_table': 'dev.test.SPOTIFY_STRIKES', 'googledoc_id': 'spreadsheetid'} def test_bootstrap(monkeypatch, context, expected_bootstrap_response): """Test bootstrap task.""" monkeypatch.setattr( config, 'SNOWFLAKE_FILE_FORMAT_TSV', 'dev.test.TSV_HEAD') monkeypatch.setattr(config, 'GOOGLEDOC_ID', 'spreadsheetid') monkeypatch.setattr(config, 'STRIKES_TABLE', 'dev.test.SPOTIFY_STRIKES') result = tasks.bootstrap(**context) assert result == expected_bootstrap_response