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.
pull/10216/head
Mehrdad Afshari 8 years ago
parent 3f90a955a9
commit a0cbe8c0f7
  1. 13
      src/python/grpcio_tests/tests/reflection/_reflection_servicer_test.py

@ -39,14 +39,18 @@ from grpc_reflection.v1alpha import reflection_pb2_grpc
from google.protobuf import descriptor_pool
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.proto2 import empty2_pb2
from src.proto.grpc.testing.proto2 import empty2_extensions_pb2
from tests.unit.framework.common import test_constants
_EMPTY_PROTO_FILE_NAME = 'src/proto/grpc/testing/empty.proto'
_EMPTY_PROTO_SYMBOL_NAME = 'grpc.testing.Empty'
_SERVICE_NAMES = ('Angstrom', 'Bohr', 'Curie', 'Dyson', 'Einstein', 'Feynman',
'Galilei')
_EMPTY_EXTENSIONS_SYMBOL_NAME = 'grpc.testing.proto2.EmptyWithExtensions'
def _file_descriptor_to_proto(descriptor):
@ -109,13 +113,10 @@ class ReflectionServicerTest(unittest.TestCase):
)),)
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):
requests = (reflection_pb2.ServerReflectionRequest(
file_containing_extension=reflection_pb2.ExtensionRequest(
containing_type='grpc.testing.proto2.Empty',
containing_type=_EMPTY_EXTENSIONS_SYMBOL_NAME,
extension_number=125,),
), reflection_pb2.ServerReflectionRequest(
file_containing_extension=reflection_pb2.ExtensionRequest(
@ -127,7 +128,7 @@ class ReflectionServicerTest(unittest.TestCase):
valid_host='',
file_descriptor_response=reflection_pb2.FileDescriptorResponse(
file_descriptor_proto=(_file_descriptor_to_proto(
empty_extensions_pb2.DESCRIPTOR),))),
empty2_extensions_pb2.DESCRIPTOR),))),
reflection_pb2.ServerReflectionResponse(
valid_host='',
error_response=reflection_pb2.ErrorResponse(

Loading…
Cancel
Save