1234567891011121314151617181920212223242526 |
- def test_execute_with_gzip(self, gcs_mock_hook, azure_fileshare_mock_hook):
- """Test the execute function when the run is successful."""
- operator = AzureFileShareToGCSOperator(
- task_id=TASK_ID,
- share_name=AZURE_FILESHARE_SHARE,
- directory_name=AZURE_FILESHARE_DIRECTORY_NAME,
- azure_fileshare_conn_id=AZURE_FILESHARE_CONN_ID,
- gcp_conn_id=GCS_CONN_ID,
- dest_gcs=GCS_PATH_PREFIX,
- google_impersonation_chain=IMPERSONATION_CHAIN,
- gzip=True,
- )
- azure_fileshare_mock_hook.return_value.list_files.return_value = MOCK_FILES
- operator.execute(None)
- gcs_mock_hook.return_value.upload.assert_has_calls(
- [
- mock.call('gcs-bucket', 'data/TEST1.csv', mock.ANY, gzip=True),
- mock.call('gcs-bucket', 'data/TEST3.csv', mock.ANY, gzip=True),
- mock.call('gcs-bucket', 'data/TEST2.csv', mock.ANY, gzip=True),
- ],
- any_order=True,
- )
|