diff --git a/google/cloud/servicedirectory_v1beta1/services/registration_service/client.py b/google/cloud/servicedirectory_v1beta1/services/registration_service/client.py index 24c06ee7..eee91499 100644 --- a/google/cloud/servicedirectory_v1beta1/services/registration_service/client.py +++ b/google/cloud/servicedirectory_v1beta1/services/registration_service/client.py @@ -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.+?)/locations/(?P.+?)/namespaces/(?P.+?)/services/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - @staticmethod def endpoint_path( project: str, location: str, namespace: str, service: str, endpoint: str @@ -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.+?)/locations/(?P.+?)/namespaces/(?P.+?)/services/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + def __init__( self, *, diff --git a/synth.metadata b/synth.metadata index 4a3ef5b3..1eeba80e 100644 --- a/synth.metadata +++ b/synth.metadata @@ -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" } } ], diff --git a/tests/unit/servicedirectory_v1beta1/test_registration_service.py b/tests/unit/servicedirectory_v1beta1/test_registration_service.py index 56a58ac2..ced075fa 100644 --- a/tests/unit/servicedirectory_v1beta1/test_registration_service.py +++ b/tests/unit/servicedirectory_v1beta1/test_registration_service.py @@ -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" @@ -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