"""Configuration for task tests.""" from unittest.mock import patch import pytest VIEW_NAME = 'view' AWS_REGION = 'aws_region' STATE_SQL = 'SELECT "state_sql"' INGESTION_STATUS_TABLE = 'ingestion_status_table' @pytest.fixture def mock_sf_config(): """Mock Snowflake config.""" return { 'role': 'test-role', 'warehouse': 'test-warehouse', 'db': 'test-db', 'schema': 'test-schema', 'user': 'test-user', 'password': 'test-password', 'account': 'test-account'} @pytest.fixture def mock_config_sf_params(mock_sf_config): """Mock config.SF_PARAMS.""" with patch( 'snowflake_views.config.SF_PARAMS', new=mock_sf_config) as config_sf_params: yield config_sf_params @pytest.fixture def mock_config_sf_microservice_params(mock_sf_config): """Mock config.SF_MICROSERVICE_PARAMS.""" with patch( 'snowflake_views.config.SF_MICROSERVICE_PARAMS', new=mock_sf_config) as config_sf_microservice_params: yield config_sf_microservice_params @pytest.fixture def mock_sf_executor_class(): """Mock SnowflakeSQLExecutor class.""" with patch( 'snowflake_views.tasks.SnowflakeSQLExecutor') as sf_executor: yield sf_executor @pytest.fixture def mock_sf_metadata_conn_class(): """Mock SnowflakeMetadataConnector class.""" with patch( 'snowflake_views.tasks.' 'SnowflakeMetadataConnector') as sf_metadata_connector: yield sf_metadata_connector @pytest.fixture def mock_sf_executor_object(mock_sf_executor_class): """Mock object of SnowflakeSQLExecutor class.""" return mock_sf_executor_class.return_value @pytest.fixture def mock_sf_metadata_conn_object(mock_sf_metadata_conn_class): """Mock object of SnowflakeMetadataConnector class.""" return mock_sf_metadata_conn_class.return_value @pytest.fixture def mock_sf_executor_context(mock_sf_executor_object): """Mock context of SnowflakeSQLExecutor object.""" return mock_sf_executor_object.__enter__.return_value @pytest.fixture def mock_sf_executor_context_validator(mock_sf_executor_context): """Mock validator of SnowflakeSQLExecutor context.""" return mock_sf_executor_context.validator @pytest.fixture def mock_aws_region(): """Mock AWS region.""" with patch( 'snowflake_views.tasks.config.AWS_REGION', new=AWS_REGION) as config_aws_region: yield config_aws_region @pytest.fixture def mock_load_view_from_config(): """Mock load_view_from_config.""" with patch('snowflake_views.tasks.' 'load_view_from_config') as load_view_from_config: load_view_from_config.return_value.state_sql = STATE_SQL yield load_view_from_config @pytest.fixture def mock_ingestion_status_table(): """Mock ingestion status table.""" with patch( 'snowflake_views.tasks.config.INGESTION_STATUS_TABLE', new=INGESTION_STATUS_TABLE) as config_ingestion_status_table: yield config_ingestion_status_table @pytest.fixture def mock_boto3_resource(): """Mock boto3 resource.""" with patch('snowflake_views.tasks.boto3.resource') as boto3_resource: yield boto3_resource @pytest.fixture def mock_dynamo_table(mock_boto3_resource): """Mock Dynamo table.""" return mock_boto3_resource.return_value.Table