def testGetFileSet_All(self): request = registry.GetFileSetRequest() request.names = ['my-service1', 'my-service2'] response = self.registry_service.get_file_set(request) expected_file_set = descriptor.describe_file_set(list(self.modules.values())) self.assertIterEqual(expected_file_set.files, response.file_set.files)
def testGetFileSet_ReferenceOtherModules(self): request = registry.GetFileSetRequest() request.names = ['my-service1'] response = self.registry_service.get_file_set(request) # Will suck in and describe the test_util module. expected_file_set = descriptor.describe_file_set(list(self.modules.values())) self.assertIterEqual(expected_file_set.files, response.file_set.files)
def testGetFileSet_DoNotReferenceOtherModules(self): request = registry.GetFileSetRequest() request.names = ['my-service2'] response = self.registry_service.get_file_set(request) # Service does not reference test_util, so will only describe this module. expected_file_set = descriptor.describe_file_set([self.modules[__name__]]) self.assertIterEqual(expected_file_set.files, response.file_set.files)
def testGetFileSet_All(self): request = registry.GetFileSetRequest() request.names = ['my-service1', 'my-service2'] response = self.registry_service.get_file_set(request) expected_file_set = descriptor.describe_file_set(self.modules.values()) expected_file_set.files.sort(key=lambda f: f.package) response.file_set.files.sort(key=lambda f: f.package) self.assertEquals(expected_file_set.files, response.file_set.files)
def main(argv): options = parse_options(argv[1:]) registry_url = 'http://%s%s' % (options.server, options.registry_path) http_transport = transport.HttpTransport(registry_url, protocol=protojson) remote_registry = registry.RegistryService.Stub(http_transport) # Get complete list of services. services = remote_registry.services() # Get file set for all services on server. get_file_set = registry.GetFileSetRequest() get_file_set.names = [service.name for service in services.services] file_set = remote_registry.get_file_set(get_file_set).file_set # Save file sets to disk. output = open(options.output, 'wb') try: output.write(protobuf.encode_message(file_set)) finally: output.close()
def testGetFileSet_None(self): request = registry.GetFileSetRequest() response = self.registry_service.get_file_set(request) self.assertEquals(descriptor.FileSet(), response.file_set)