Ejemplo n.º 1
0
 async def test_file_containing_extension(self):
     requests = (
         reflection_pb2.ServerReflectionRequest(
             file_containing_extension=reflection_pb2.ExtensionRequest(
                 containing_type=_EMPTY_EXTENSIONS_SYMBOL_NAME,
                 extension_number=125,
             ), ),
         reflection_pb2.ServerReflectionRequest(
             file_containing_extension=reflection_pb2.ExtensionRequest(
                 containing_type='i.donut.exist.co.uk.org.net.me.name.foo',
                 extension_number=55,
             ), ),
     )
     responses = []
     async for response in self._stub.ServerReflectionInfo(iter(requests)):
         responses.append(response)
     expected_responses = (
         reflection_pb2.ServerReflectionResponse(
             valid_host='',
             file_descriptor_response=reflection_pb2.FileDescriptorResponse(
                 file_descriptor_proto=(_file_descriptor_to_proto(
                     empty2_extensions_pb2.DESCRIPTOR), ))),
         reflection_pb2.ServerReflectionResponse(
             valid_host='',
             error_response=reflection_pb2.ErrorResponse(
                 error_code=grpc.StatusCode.NOT_FOUND.value[0],
                 error_message=grpc.StatusCode.NOT_FOUND.value[1].encode(),
             )),
     )
     self.assertSequenceEqual(expected_responses, responses)
Ejemplo n.º 2
0
 def testFileContainingExtension(self):
   requests = (
     reflection_pb2.ServerReflectionRequest(
       file_containing_extension=reflection_pb2.ExtensionRequest(
         containing_type='grpc.testing.proto2.Empty',
         extension_number=125,
       ),
     ),
     reflection_pb2.ServerReflectionRequest(
       file_containing_extension=reflection_pb2.ExtensionRequest(
         containing_type='i.donut.exist.co.uk.org.net.me.name.foo',
         extension_number=55,
       ),
     ),
   )
   responses = tuple(self._stub.ServerReflectionInfo(iter(requests)))
   expected_responses = (
     reflection_pb2.ServerReflectionResponse(
       valid_host='',
       file_descriptor_response=reflection_pb2.FileDescriptorResponse(
         file_descriptor_proto=(
           _file_descriptor_to_proto(empty_extensions_pb2.DESCRIPTOR),
         )
       )
     ),
     reflection_pb2.ServerReflectionResponse(
       valid_host='',
       error_response=reflection_pb2.ErrorResponse(
         error_code=grpc.StatusCode.NOT_FOUND.value[0],
         error_message=grpc.StatusCode.NOT_FOUND.value[1].encode(),
       )
     ),
   )
   self.assertSequenceEqual(expected_responses, responses)