def test_operation_pause_should_throw_ex_when_name_none(self, mock_hook): with self.assertRaises(AirflowException) as cm: op = GcpTransferServiceOperationPauseOperator(operation_name="", task_id='task-id') op.execute(None) err = cm.exception self.assertIn("The required parameter 'operation_name' is empty or None", str(err)) mock_hook.assert_not_called()
def test_operation_pause(self, mock_hook): op = GcpTransferServiceOperationPauseOperator( operation_name=OPERATION_NAME, 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.pause_transfer_operation.assert_called_once_with( operation_name=OPERATION_NAME)
def test_operation_pause(self, mock_hook): op = GcpTransferServiceOperationPauseOperator(operation_name=OPERATION_NAME, 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.pause_transfer_operation.assert_called_once_with(operation_name=OPERATION_NAME)