"""Test sync_transaction_types.""" from unittest.mock import MagicMock from unittest.mock import patch from abacus_etl_tools.sync_transaction_types import main @patch('abacus_etl_tools.sync_transaction_types.config') @patch('abacus_etl_tools.sync_transaction_types.SnowflakeSQLExecutor') @patch('abacus_etl_tools.sync_transaction_types.Path') def test_sync_transaction_types(mock_path, mock_connector, mock_config): """Tests running ETL.""" mock_path.return_value.read_text.return_value = '{db} {schema} {s3_path} {s3_filename} {stage}' # noqa: E501 mock_executor = MagicMock() mock_connector.return_value.__enter__.return_value.execute = mock_executor mock_config.SNOWFLAKE = { 'db': 'foo', 'schema': 'bar' } mock_config.TRANSACTION_TYPE_SYNC = { 's3_path': 'baz', 's3_filename': 'qux', 'stage': 'rus' } main() assert mock_executor.called_once assert mock_executor.call_args[0][0] == 'foo bar baz qux rus'