Exemplo n.º 1
0
 def test_job_delete_should_throw_ex_when_name_none(self, mock_hook):
     with self.assertRaises(AirflowException) as cm:
         op = GcpTransferServiceJobDeleteOperator(job_name="", task_id='task-id')
         op.execute(None)
     err = cm.exception
     self.assertIn("The required parameter 'job_name' is empty or None", str(err))
     mock_hook.assert_not_called()
 def test_job_delete_should_throw_ex_when_name_none(self, mock_hook):
     with self.assertRaises(AirflowException) as cm:
         op = GcpTransferServiceJobDeleteOperator(job_name="", task_id='task-id')
         op.execute(None)
     err = cm.exception
     self.assertIn("The required parameter 'job_name' is empty or None", str(err))
     mock_hook.assert_not_called()
Exemplo n.º 3
0
 def test_job_delete(self, mock_hook):
     op = GcpTransferServiceJobDeleteOperator(
         job_name=JOB_NAME, project_id=GCP_PROJECT_ID, task_id='task-id'
     )
     op.execute(None)
     mock_hook.assert_called_once_with(api_version='v1', gcp_conn_id='google_cloud_default')
     mock_hook.return_value.delete_transfer_job.assert_called_once_with(
         job_name=JOB_NAME, project_id=GCP_PROJECT_ID
     )
 def test_job_delete(self, mock_hook):
     op = GcpTransferServiceJobDeleteOperator(
         job_name=JOB_NAME, project_id=GCP_PROJECT_ID, task_id='task-id'
     )
     op.execute(None)
     mock_hook.assert_called_once_with(api_version='v1', gcp_conn_id='google_cloud_default')
     mock_hook.return_value.delete_transfer_job.assert_called_once_with(
         job_name=JOB_NAME, project_id=GCP_PROJECT_ID
     )