def test_operation_list(self, mock_hook):
     mock_hook.return_value.list_transfer_operations.return_value = [VALID_TRANSFER_JOB_GCS]
     op = CloudDataTransferServiceListOperationsOperator(request_filter=TEST_FILTER, task_id=TASK_ID)
     result = op.execute(None)
     mock_hook.assert_called_once_with(api_version='v1', gcp_conn_id='google_cloud_default')
     mock_hook.return_value.list_transfer_operations.assert_called_once_with(request_filter=TEST_FILTER)
     self.assertEqual(result, [VALID_TRANSFER_JOB_GCS])
Example #2
0
 def test_operation_list(self, mock_hook):
     mock_hook.return_value.list_transfer_operations.return_value = [
         VALID_TRANSFER_JOB_GCS
     ]
     op = CloudDataTransferServiceListOperationsOperator(
         request_filter=TEST_FILTER,
         task_id=TASK_ID,
         google_impersonation_chain=IMPERSONATION_CHAIN,
     )
     result = op.execute(None)
     mock_hook.assert_called_once_with(
         api_version='v1',
         gcp_conn_id='google_cloud_default',
         impersonation_chain=IMPERSONATION_CHAIN,
     )
     mock_hook.return_value.list_transfer_operations.assert_called_once_with(
         request_filter=TEST_FILTER)
     assert result == [VALID_TRANSFER_JOB_GCS]