turbaszek commented on a change in pull request #14276:
URL: https://github.com/apache/airflow/pull/14276#discussion_r578389753
##########
File path: tests/providers/google/cloud/transfers/test_gdrive_to_gcs.py
##########
@@ -85,13 +46,14 @@ def test_execute(self, mock_upload_data, mock_gdrive_hook,
mock_gcs_hook):
)
op.execute(context)
- mock_gdrive_hook.assert_called_once_with(
- gcp_conn_id=GCP_CONN_ID,
- delegate_to=None,
- impersonation_chain=IMPERSONATION_CHAIN,
+ mock_gdrive_hook.return_value.get_file_id.assert_called_once_with(
+ folder_id=FOLDER_ID, file_name=FILE_NAME, drive_id=DRIVE_ID
)
- mock_gcs_hook.assert_called_once_with(
- gcp_conn_id=GCP_CONN_ID,
- delegate_to=None,
- impersonation_chain=IMPERSONATION_CHAIN,
+
+ mock_gdrive_hook.return_value.download_file.assert_called_once_with(
+ file_id=mock.ANY, file_handle=mock.ANY
Review comment:
I think we should test that the `file_id` is passed properly. So I would
suggest adding this before `op.execute`:
```
meta = {"id": "123xyz"}
mock_gdrive_hook.return_value.get_file_id.return_value = meta
```
and then we can do
```suggestion
mock_gdrive_hook.return_value.download_file.assert_called_once_with(
file_id=meta["id"], file_handle=mock.ANY
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]