def test_delete_inspect_template(self, mock_hook): mock_hook.return_value.delete_inspect_template.return_value = {} operator = CloudDLPDeleteInspectTemplateOperator( template_id=TEMPLATE_ID, organization_id=ORGANIZATION_ID, task_id="id") operator.execute(context=None) mock_hook.assert_called_once_with(gcp_conn_id=GCP_CONN_ID) mock_hook.return_value.delete_inspect_template.assert_called_once_with( template_id=TEMPLATE_ID, organization_id=ORGANIZATION_ID, project_id=None, retry=None, timeout=None, metadata=None, )
# [END howto_operator_dlp_create_inspect_template] # [START howto_operator_dlp_use_inspect_template] inspect_content = CloudDLPInspectContentOperator( task_id="inpsect_content", project_id=GCP_PROJECT, item=ITEM, inspect_template_name= "{{ task_instance.xcom_pull('create_template', key='return_value')['name'] }}", ) # [END howto_operator_dlp_use_inspect_template] # [START howto_operator_dlp_delete_inspect_template] delete_template = CloudDLPDeleteInspectTemplateOperator( task_id="delete_template", template_id=TEMPLATE_ID, project_id=GCP_PROJECT, ) # [END howto_operator_dlp_delete_inspect_template] create_template >> inspect_content >> delete_template CUSTOM_INFO_TYPE_ID = "custom_info_type" CUSTOM_INFO_TYPES = { "large_custom_dictionary": { "output_path": { "path": OBJECT_GCS_OUTPUT_URI }, "cloud_storage_file_set": { "url": OBJECT_GCS_URI + "/" },