Skip to content

Commit

Permalink
chore: use python-samples-reviewers (#278)
Browse files Browse the repository at this point in the history
  • Loading branch information
gcf-owl-bot[bot] authored Jan 6, 2022
1 parent 8f4239e commit c90c6cd
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
docker:
image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest
digest: sha256:74124fe59b8859f30143dcdea7b78300046d97de816dc53c0e381308a5f4f8bc
digest: sha256:899d5d7cc340fa8ef9d8ae1a8cfba362c6898584f779e156f25ee828ba824610
4 changes: 2 additions & 2 deletions packages/google-cloud-datacatalog/.github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
# @googleapis/yoshi-python is the default owner for changes in this repo
* @googleapis/yoshi-python

# @googleapis/python-samples-owners is the default owner for samples changes
/samples/ @googleapis/python-samples-owners
# @googleapis/python-samples-reviewers is the default owner for samples changes
/samples/ @googleapis/python-samples-reviewers
13 changes: 8 additions & 5 deletions packages/google-cloud-datacatalog/samples/snippets/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,18 @@ def policy_tag_manager_client(credentials):
@pytest.fixture
def random_taxonomy_display_name(policy_tag_manager_client, project_id):
now = datetime.datetime.now()
random_display_name = f'example_taxonomy' \
f'_{now.strftime("%Y%m%d%H%M%S")}' \
f'_{uuid.uuid4().hex[:8]}'
random_display_name = (
f"example_taxonomy"
f'_{now.strftime("%Y%m%d%H%M%S")}'
f"_{uuid.uuid4().hex[:8]}"
)
yield random_display_name
parent = datacatalog_v1.PolicyTagManagerClient.common_location_path(
project_id, 'us'
project_id, "us"
)
taxonomies = policy_tag_manager_client.list_taxonomies(parent=parent)
taxonomy = next(
(t for t in taxonomies if t.display_name == random_display_name), None)
(t for t in taxonomies if t.display_name == random_display_name), None
)
if taxonomy:
policy_tag_manager_client.delete_taxonomy(name=taxonomy.name)
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@ def create_taxonomy(
# TODO(developer): Set project_id to the ID of the project the
# taxonomy will belong to.
project_id: str = "your-project-id",

# TODO(developer): Specify the geographic location where the
# taxonomy should reside.
location_id: str = "us",

# TODO(developer): Set the display name of the taxonomy.
display_name: str = "example-taxonomy",
):
Expand All @@ -41,10 +39,11 @@ def create_taxonomy(
# TODO(developer): Construct a full Taxonomy object to send to the API.
taxonomy = datacatalog_v1.Taxonomy()
taxonomy.display_name = display_name
taxonomy.description = 'This Taxonomy represents ...'
taxonomy.description = "This Taxonomy represents ..."

# Send the taxonomy to the API for creation.
taxonomy = client.create_taxonomy(parent=parent, taxonomy=taxonomy)
print(f'Created taxonomy {taxonomy.name}')
print(f"Created taxonomy {taxonomy.name}")


# [END data_catalog_ptm_create_taxonomy]
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@
import data_catalog_ptm_create_taxonomy


def test_create_taxonomy(capsys,
project_id: str,
random_taxonomy_display_name: str):
def test_create_taxonomy(capsys, project_id: str, random_taxonomy_display_name: str):

data_catalog_ptm_create_taxonomy.create_taxonomy(
project_id=project_id, location_id="us", display_name=random_taxonomy_display_name)
out, _ = capsys.readouterr()
assert (
f'Created taxonomy projects/{project_id}/locations/us/taxonomies/'
in out
project_id=project_id,
location_id="us",
display_name=random_taxonomy_display_name,
)
out, _ = capsys.readouterr()
assert f"Created taxonomy projects/{project_id}/locations/us/taxonomies/" in out

0 comments on commit c90c6cd

Please sign in to comment.