mik-laj commented on a change in pull request #7664: [AIRFLOW-5013] Add GCP Data Catalog Hook and operators URL: https://github.com/apache/airflow/pull/7664#discussion_r389973663
########## File path: tests/providers/google/cloud/operators/test_datacatalog.py ########## @@ -0,0 +1,755 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +from typing import Dict, Sequence, Tuple +from unittest import TestCase, mock + +from google.api_core.exceptions import AlreadyExists +from google.api_core.retry import Retry +from google.cloud.datacatalog_v1beta1.types import Entry, EntryGroup, Tag, TagTemplate, TagTemplateField + +from airflow.providers.google.cloud.operators.datacatalog import ( + CloudDataCatalogCreateEntryGroupOperator, CloudDataCatalogCreateEntryOperator, + CloudDataCatalogCreateTagOperator, CloudDataCatalogCreateTagTemplateFieldOperator, + CloudDataCatalogCreateTagTemplateOperator, CloudDataCatalogDeleteEntryGroupOperator, + CloudDataCatalogDeleteEntryOperator, CloudDataCatalogDeleteTagOperator, + CloudDataCatalogDeleteTagTemplateFieldOperator, CloudDataCatalogDeleteTagTemplateOperator, + CloudDataCatalogGetEntryGroupOperator, CloudDataCatalogGetEntryOperator, + CloudDataCatalogGetTagTemplateOperator, CloudDataCatalogListTagsOperator, + CloudDataCatalogLookupEntryOperator, CloudDataCatalogRenameTagTemplateFieldOperator, + CloudDataCatalogSearchCatalogOperator, CloudDataCatalogUpdateEntryOperator, + CloudDataCatalogUpdateTagOperator, CloudDataCatalogUpdateTagTemplateFieldOperator, + CloudDataCatalogUpdateTagTemplateOperator, +) + +TEST_PROJECT_ID: str = "example_id" +TEST_LOCATION: str = "en-west-3" +TEST_ENTRY_ID: str = "test-entry-id" +TEST_TAG_ID: str = "test-tag-id" +TEST_RETRY: Retry = Retry() +TEST_TIMEOUT: float = 0.5 +TEST_METADATA: Sequence[Tuple[str, str]] = [] +TEST_GCP_CONN_ID: str = "test-gcp-conn-id" +TEST_ENTRY_GROUP_ID: str = "test-entry-group-id" +TEST_TAG_TEMPLATE_ID: str = "test-tag-template-id" +TEST_TAG_TEMPLATE_FIELD_ID: str = "test-tag-template-field-id" +TEST_TAG_TEMPLATE_NAME: str = "test-tag-template-field-name" +TEST_FORCE: bool = False +TEST_READ_MASK: Dict = {"fields": ["name"]} +TEST_RESOURCE: str = "test-resource" +TEST_OPTIONS_: Dict = {} +TEST_PAGE_SIZE: int = 50 +TEST_LINKED_RESOURCE: str = "test-linked-resource" +TEST_SQL_RESOURCE: str = "test-sql-resource" +TEST_NEW_TAG_TEMPLATE_FIELD_ID: str = "test-new-tag-template-field-id" +TEST_SCOPE: Dict = dict(include_project_ids=["example-scope-project"]) +TEST_QUERY: str = "test-query" +TEST_ORDER_BY: str = "test-order-by" +TEST_UPDATE_MASK: Dict = {"fields": ["name"]} Review comment: This is not necessary, but it prevents accidental mistake. The following code will raise a mypy error: ```python TEST_QUERY: str = "test-query", ``` It contains a very small change. Only one comma, which is very easy to miss. If we have explicit types annotation, this change will be detected very easily. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
