From 03d9500ec022b6c307d982b05c7d5b6917bbcec5 Mon Sep 17 00:00:00 2001 From: Mehrdad Afshari Date: Mon, 20 Mar 2017 08:05:25 +0000 Subject: Test all_extension_numbers_of_type --- .../tests/reflection/_reflection_servicer_test.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src') diff --git a/src/python/grpcio_tests/tests/reflection/_reflection_servicer_test.py b/src/python/grpcio_tests/tests/reflection/_reflection_servicer_test.py index 5163ffe738..69192a2b74 100644 --- a/src/python/grpcio_tests/tests/reflection/_reflection_servicer_test.py +++ b/src/python/grpcio_tests/tests/reflection/_reflection_servicer_test.py @@ -51,6 +51,7 @@ _EMPTY_PROTO_SYMBOL_NAME = 'grpc.testing.Empty' _SERVICE_NAMES = ('Angstrom', 'Bohr', 'Curie', 'Dyson', 'Einstein', 'Feynman', 'Galilei') _EMPTY_EXTENSIONS_SYMBOL_NAME = 'grpc.testing.proto2.EmptyWithExtensions' +_EMPTY_EXTENSIONS_NUMBERS = (124, 125, 126, 127, 128,) def _file_descriptor_to_proto(descriptor): @@ -137,6 +138,27 @@ class ReflectionServicerTest(unittest.TestCase): )),) self.assertSequenceEqual(expected_responses, responses) + def testExtensionNumbersOfType(self): + requests = (reflection_pb2.ServerReflectionRequest( + all_extension_numbers_of_type=_EMPTY_EXTENSIONS_SYMBOL_NAME + ), reflection_pb2.ServerReflectionRequest( + all_extension_numbers_of_type='i.donut.exist.co.uk.net.name.foo'),) + responses = tuple(self._stub.ServerReflectionInfo(iter(requests))) + expected_responses = ( + reflection_pb2.ServerReflectionResponse( + valid_host='', + all_extension_numbers_response=reflection_pb2. + ExtensionNumberResponse( + base_type_name=_EMPTY_EXTENSIONS_SYMBOL_NAME, + extension_number=_EMPTY_EXTENSIONS_NUMBERS)), + 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) + def testListServices(self): requests = (reflection_pb2.ServerReflectionRequest( list_services='',),) -- cgit v1.2.3