def test_assert_valid_hook_call(self, mock_hook) -> None: task = CloudDataCatalogLookupEntryOperator( task_id="task_id", linked_resource=TEST_LINKED_RESOURCE, sql_resource=TEST_SQL_RESOURCE, retry=TEST_RETRY, timeout=TEST_TIMEOUT, metadata=TEST_METADATA, gcp_conn_id=TEST_GCP_CONN_ID, ) task.execute(context=mock.MagicMock()) mock_hook.assert_called_once_with(gcp_conn_id=TEST_GCP_CONN_ID) mock_hook.return_value.lookup_entry.assert_called_once_with( linked_resource=TEST_LINKED_RESOURCE, sql_resource=TEST_SQL_RESOURCE, retry=TEST_RETRY, timeout=TEST_TIMEOUT, metadata=TEST_METADATA, )
# [START howto_operator_gcp_datacatalog_list_tags_result] list_tags_result = BashOperator( task_id="list_tags_result", bash_command="echo \"{{ task_instance.xcom_pull('list_tags') }}\"") # [END howto_operator_gcp_datacatalog_list_tags_result] # Lookup # [START howto_operator_gcp_datacatalog_lookup_entry_linked_resource] current_entry_template = ( "//datacatalog.googleapis.com/projects/{project_id}/locations/{location}/" "entryGroups/{entry_group}/entries/{entry}") lookup_entry_linked_resource = CloudDataCatalogLookupEntryOperator( task_id="lookup_entry", linked_resource=current_entry_template.format( project_id=PROJECT_ID, location=LOCATION, entry_group=ENTRY_GROUP_ID, entry=ENTRY_ID), ) # [END howto_operator_gcp_datacatalog_lookup_entry_linked_resource] # [START howto_operator_gcp_datacatalog_lookup_entry_result] lookup_entry_result = BashOperator( task_id="lookup_entry_result", bash_command= "echo \"{{ task_instance.xcom_pull('lookup_entry')['displayName'] }}\"", ) # [END howto_operator_gcp_datacatalog_lookup_entry_result] # Rename # [START howto_operator_gcp_datacatalog_rename_tag_template_field]