diff options
author | Mehrdad Afshari <mmx@google.com> | 2017-03-20 08:05:25 +0000 |
---|---|---|
committer | Mehrdad Afshari <mmx@google.com> | 2017-03-23 09:15:33 -0700 |
commit | 03d9500ec022b6c307d982b05c7d5b6917bbcec5 (patch) | |
tree | 760d1ebd33700ea3be7bfb760dc2fb32aaba1610 /src | |
parent | 8be4e03af2dddb4bdc89df8595a30c8d5fc7cb12 (diff) |
Test all_extension_numbers_of_type
Diffstat (limited to 'src')
-rw-r--r-- | src/python/grpcio_tests/tests/reflection/_reflection_servicer_test.py | 22 |
1 files changed, 22 insertions, 0 deletions
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='',),) |