Skip to content
This repository was archived by the owner on Sep 5, 2023. It is now read-only.

chore: update templates #6

Merged
merged 16 commits into from
May 28, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: autosynth for nodejs-apiary (#569)
* fix: autosynth for nodejs-apiary

A configuration file was lost during the copy from gerrit to github.

* chore: remove old copy of node-apiary.yaml

Source-Author: Jeffrey Rennie <[email protected]>
Source-Date: Tue May 19 16:51:15 2020 -0700
Source-Repo: googleapis/synthtool
Source-Sha: 274dd49554809834287c24b6dd324a85283f1182
Source-Link: googleapis/synthtool@274dd49
  • Loading branch information
yoshi-automation committed May 27, 2020
commit 9d789df2d03275f3d73cecf059fb5691a5748625
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,17 @@ def from_service_account_file(cls, filename: str, *args, **kwargs):

from_service_account_json = from_service_account_file

@staticmethod
def key_path(project: str, key: str) -> str:
"""Return a fully-qualified key string."""
return "projects/{project}/keys/{key}".format(project=project, key=key)

@staticmethod
def parse_key_path(path: str) -> Dict[str, str]:
"""Parse a key path into its component segments."""
m = re.match(r"^projects/(?P<project>.+?)/keys/(?P<key>.+?)$", path)
return m.groupdict() if m else {}

@staticmethod
def assessment_path(project: str, assessment: str) -> str:
"""Return a fully-qualified assessment string."""
Expand All @@ -143,17 +154,6 @@ def parse_assessment_path(path: str) -> Dict[str, str]:
)
return m.groupdict() if m else {}

@staticmethod
def key_path(project: str, key: str) -> str:
"""Return a fully-qualified key string."""
return "projects/{project}/keys/{key}".format(project=project, key=key)

@staticmethod
def parse_key_path(path: str) -> Dict[str, str]:
"""Parse a key path into its component segments."""
m = re.match(r"^projects/(?P<project>.+?)/keys/(?P<key>.+?)$", path)
return m.groupdict() if m else {}

def __init__(
self,
*,
Expand Down
2 changes: 1 addition & 1 deletion synth.metadata
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"git": {
"name": "synthtool",
"remote": "https://github.com/googleapis/synthtool.git",
"sha": "d2364eb80b840a36136c8ce12f1c6efabcc9600e"
"sha": "274dd49554809834287c24b6dd324a85283f1182"
}
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -749,39 +749,39 @@ def test_recaptcha_enterprise_service_grpc_transport_channel_mtls_with_adc(
assert transport.grpc_channel == mock_grpc_channel


def test_assessment_path():
def test_key_path():
project = "squid"
assessment = "clam"
key = "clam"

expected = "projects/{project}/assessments/{assessment}".format(
project=project, assessment=assessment
)
actual = RecaptchaEnterpriseServiceClient.assessment_path(project, assessment)
expected = "projects/{project}/keys/{key}".format(project=project, key=key)
actual = RecaptchaEnterpriseServiceClient.key_path(project, key)
assert expected == actual


def test_parse_assessment_path():
expected = {"project": "whelk", "assessment": "octopus"}
path = RecaptchaEnterpriseServiceClient.assessment_path(**expected)
def test_parse_key_path():
expected = {"project": "whelk", "key": "octopus"}
path = RecaptchaEnterpriseServiceClient.key_path(**expected)

# Check that the path construction is reversible.
actual = RecaptchaEnterpriseServiceClient.parse_assessment_path(path)
actual = RecaptchaEnterpriseServiceClient.parse_key_path(path)
assert expected == actual


def test_key_path():
def test_assessment_path():
project = "squid"
key = "clam"
assessment = "clam"

expected = "projects/{project}/keys/{key}".format(project=project, key=key)
actual = RecaptchaEnterpriseServiceClient.key_path(project, key)
expected = "projects/{project}/assessments/{assessment}".format(
project=project, assessment=assessment
)
actual = RecaptchaEnterpriseServiceClient.assessment_path(project, assessment)
assert expected == actual


def test_parse_key_path():
expected = {"project": "whelk", "key": "octopus"}
path = RecaptchaEnterpriseServiceClient.key_path(**expected)
def test_parse_assessment_path():
expected = {"project": "whelk", "assessment": "octopus"}
path = RecaptchaEnterpriseServiceClient.assessment_path(**expected)

# Check that the path construction is reversible.
actual = RecaptchaEnterpriseServiceClient.parse_key_path(path)
actual = RecaptchaEnterpriseServiceClient.parse_assessment_path(path)
assert expected == actual