def setUp(self): # Create a resource map with two resources: # # 'resource_list' is a list with two values, each with an 'attr' # attribute. This is how resources with multiple values are normally # stored. # # 'resource_tuple' is similar to 'resource_list', holding the same data # but using a tuple instead of a list. # # 'resource_dict' is a dictionary with one attribute 'name'. This is # how resources with one value might be stored. self.resource_map = ResourceMap({ 'resource_list': [ {"attr": "value"}, {"attr": "other-value"} ], 'resource_tuple': ( {"attr": "value"}, {"attr": "other-value"} ), 'resource_dict': {"attr": "value"}, 'resource_int': 42, }) # This is an empty map, it is used by some of the tests self.empty_map = ResourceMap()
def register(self, manager): super(ResourceInfo, self).register(manager) self.resources = ResourceMap() self._manager.reactor.call_on("report-resource", self.report_resource) self._manager.reactor.call_on("prompt-job", self.prompt_job, -10)