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

Commit

Permalink
fix: --recurse-submodules when cloning repos (#590)
Browse files Browse the repository at this point in the history
fixes googleapis/synthtool#509

Source-Author: Jeffrey Rennie <rennie@google.com>
Source-Date: Fri May 29 13:40:19 2020 -0700
Source-Repo: googleapis/synthtool
Source-Sha: 385d537832113984af2d033aaf353f0432256527
Source-Link: googleapis/synthtool@385d537
  • Loading branch information
yoshi-automation committed May 30, 2020
1 parent d5e2bb2 commit ef3116f
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 47 deletions.
Expand Up @@ -150,22 +150,6 @@ def from_service_account_file(cls, filename: str, *args, **kwargs):

from_service_account_json = from_service_account_file

@staticmethod
def service_path(project: str, location: str, namespace: str, service: str) -> str:
"""Return a fully-qualified service string."""
return "projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}".format(
project=project, location=location, namespace=namespace, service=service
)

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

@staticmethod
def endpoint_path(
project: str, location: str, namespace: str, service: str, endpoint: str
Expand Down Expand Up @@ -204,6 +188,22 @@ def parse_namespace_path(path: str) -> Dict[str, str]:
)
return m.groupdict() if m else {}

@staticmethod
def service_path(project: str, location: str, namespace: str, service: str) -> str:
"""Return a fully-qualified service string."""
return "projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}".format(
project=project, location=location, namespace=namespace, service=service
)

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

def __init__(
self,
*,
Expand Down
4 changes: 2 additions & 2 deletions synth.metadata
Expand Up @@ -19,14 +19,14 @@
"git": {
"name": "synthtool",
"remote": "https://github.com/googleapis/synthtool.git",
"sha": "4e1d2cb79b02d7496b1452f91c518630c207145e"
"sha": "385d537832113984af2d033aaf353f0432256527"
}
},
{
"git": {
"name": "synthtool",
"remote": "https://github.com/googleapis/synthtool.git",
"sha": "4e1d2cb79b02d7496b1452f91c518630c207145e"
"sha": "385d537832113984af2d033aaf353f0432256527"
}
}
],
Expand Down
58 changes: 29 additions & 29 deletions tests/unit/servicedirectory_v1beta1/test_registration_service.py
Expand Up @@ -1728,35 +1728,6 @@ def test_registration_service_grpc_transport_channel_mtls_with_adc(
assert transport.grpc_channel == mock_grpc_channel


def test_service_path():
project = "squid"
location = "clam"
namespace = "whelk"
service = "octopus"

expected = "projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}".format(
project=project, location=location, namespace=namespace, service=service
)
actual = RegistrationServiceClient.service_path(
project, location, namespace, service
)
assert expected == actual


def test_parse_service_path():
expected = {
"project": "oyster",
"location": "nudibranch",
"namespace": "cuttlefish",
"service": "mussel",
}
path = RegistrationServiceClient.service_path(**expected)

# Check that the path construction is reversible.
actual = RegistrationServiceClient.parse_service_path(path)
assert expected == actual


def test_endpoint_path():
project = "squid"
location = "clam"
Expand Down Expand Up @@ -1811,3 +1782,32 @@ def test_parse_namespace_path():
# Check that the path construction is reversible.
actual = RegistrationServiceClient.parse_namespace_path(path)
assert expected == actual


def test_service_path():
project = "squid"
location = "clam"
namespace = "whelk"
service = "octopus"

expected = "projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}".format(
project=project, location=location, namespace=namespace, service=service
)
actual = RegistrationServiceClient.service_path(
project, location, namespace, service
)
assert expected == actual


def test_parse_service_path():
expected = {
"project": "oyster",
"location": "nudibranch",
"namespace": "cuttlefish",
"service": "mussel",
}
path = RegistrationServiceClient.service_path(**expected)

# Check that the path construction is reversible.
actual = RegistrationServiceClient.parse_service_path(path)
assert expected == actual

0 comments on commit ef3116f

Please sign in to comment.