eladkal commented on code in PR #35704:
URL: https://github.com/apache/airflow/pull/35704#discussion_r1444052299
##########
tests/providers/google/cloud/transfers/test_gcs_to_sftp.py:
##########
@@ -116,7 +116,55 @@ def test_execute_move_single_file(
)
sftp_hook_mock.return_value.store_file.assert_called_with(
- os.path.join(DESTINATION_SFTP, target_object), mock.ANY
+ os.path.join(DESTINATION_SFTP, target_object), mock.ANY,
confirm=True
+ )
+
+ gcs_hook_mock.return_value.delete.assert_called_once_with(TEST_BUCKET,
source_object)
+
+ @pytest.mark.parametrize(
+ "source_object, target_object, keep_directory_structure, confirm",
+ [
+ ("folder/test_object.txt", "folder/test_object.txt", True, True),
+ ("folder/subfolder/test_object.txt",
"folder/subfolder/test_object.txt", True, True),
+ ("folder/test_object.txt", "test_object.txt", False, True),
+ ("folder/subfolder/test_object.txt", "test_object.txt", False,
True),
+
+ ("folder/test_object.txt", "folder/test_object.txt", True, False),
+ ("folder/subfolder/test_object.txt",
"folder/subfolder/test_object.txt", True, False),
+ ("folder/test_object.txt", "test_object.txt", False, False),
+ ("folder/subfolder/test_object.txt", "test_object.txt", False,
False),
+ ],
+ )
+ @mock.patch("airflow.providers.google.cloud.transfers.gcs_to_sftp.GCSHook")
+
@mock.patch("airflow.providers.google.cloud.transfers.gcs_to_sftp.SFTPHook")
+ def test_confirm_store_file(
+ self, sftp_hook_mock, gcs_hook_mock, source_object, target_object,
keep_directory_structure, confirm
+ ):
+ task = GCSToSFTPOperator(
+ task_id=TASK_ID,
+ source_bucket=TEST_BUCKET,
+ source_object=source_object,
+ destination_path=DESTINATION_SFTP,
+ keep_directory_structure=keep_directory_structure,
+ move_object=True,
+ gcp_conn_id=GCP_CONN_ID,
+ sftp_conn_id=SFTP_CONN_ID,
+ impersonation_chain=IMPERSONATION_CHAIN,
+ confirm=confirm
Review Comment:
```suggestion
confirm=confirm,
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]