Skip to content
Snippets Groups Projects
Commit a0cbe8c0 authored by Mehrdad Afshari's avatar Mehrdad Afshari
Browse files

Fix and un-skip testFileContainingExtension

Fix and un-skip the test for _file_containing_extension
in python reflection service to refer to the correct proto
and expect the right object to be returned. Enable it too.
parent 3f90a955
Branches
Tags
No related merge requests found
...@@ -39,14 +39,18 @@ from grpc_reflection.v1alpha import reflection_pb2_grpc ...@@ -39,14 +39,18 @@ from grpc_reflection.v1alpha import reflection_pb2_grpc
from google.protobuf import descriptor_pool from google.protobuf import descriptor_pool
from google.protobuf import descriptor_pb2 from google.protobuf import descriptor_pb2
from src.proto.grpc.testing.proto2 import empty2_extensions_pb2
from src.proto.grpc.testing import empty_pb2 from src.proto.grpc.testing import empty_pb2
from src.proto.grpc.testing.proto2 import empty2_pb2
from src.proto.grpc.testing.proto2 import empty2_extensions_pb2
from tests.unit.framework.common import test_constants from tests.unit.framework.common import test_constants
_EMPTY_PROTO_FILE_NAME = 'src/proto/grpc/testing/empty.proto' _EMPTY_PROTO_FILE_NAME = 'src/proto/grpc/testing/empty.proto'
_EMPTY_PROTO_SYMBOL_NAME = 'grpc.testing.Empty' _EMPTY_PROTO_SYMBOL_NAME = 'grpc.testing.Empty'
_SERVICE_NAMES = ('Angstrom', 'Bohr', 'Curie', 'Dyson', 'Einstein', 'Feynman', _SERVICE_NAMES = ('Angstrom', 'Bohr', 'Curie', 'Dyson', 'Einstein', 'Feynman',
'Galilei') 'Galilei')
_EMPTY_EXTENSIONS_SYMBOL_NAME = 'grpc.testing.proto2.EmptyWithExtensions'
def _file_descriptor_to_proto(descriptor): def _file_descriptor_to_proto(descriptor):
...@@ -109,13 +113,10 @@ class ReflectionServicerTest(unittest.TestCase): ...@@ -109,13 +113,10 @@ class ReflectionServicerTest(unittest.TestCase):
)),) )),)
self.assertSequenceEqual(expected_responses, responses) self.assertSequenceEqual(expected_responses, responses)
@unittest.skip(
'TODO(atash): implement file-containing-extension reflection '
'(see https://github.com/google/protobuf/issues/2248)')
def testFileContainingExtension(self): def testFileContainingExtension(self):
requests = (reflection_pb2.ServerReflectionRequest( requests = (reflection_pb2.ServerReflectionRequest(
file_containing_extension=reflection_pb2.ExtensionRequest( file_containing_extension=reflection_pb2.ExtensionRequest(
containing_type='grpc.testing.proto2.Empty', containing_type=_EMPTY_EXTENSIONS_SYMBOL_NAME,
extension_number=125,), extension_number=125,),
), reflection_pb2.ServerReflectionRequest( ), reflection_pb2.ServerReflectionRequest(
file_containing_extension=reflection_pb2.ExtensionRequest( file_containing_extension=reflection_pb2.ExtensionRequest(
...@@ -127,7 +128,7 @@ class ReflectionServicerTest(unittest.TestCase): ...@@ -127,7 +128,7 @@ class ReflectionServicerTest(unittest.TestCase):
valid_host='', valid_host='',
file_descriptor_response=reflection_pb2.FileDescriptorResponse( file_descriptor_response=reflection_pb2.FileDescriptorResponse(
file_descriptor_proto=(_file_descriptor_to_proto( file_descriptor_proto=(_file_descriptor_to_proto(
empty_extensions_pb2.DESCRIPTOR),))), empty2_extensions_pb2.DESCRIPTOR),))),
reflection_pb2.ServerReflectionResponse( reflection_pb2.ServerReflectionResponse(
valid_host='', valid_host='',
error_response=reflection_pb2.ErrorResponse( error_response=reflection_pb2.ErrorResponse(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment