def populate_components(self): """Populates the component tree with the available components""" root_node = ComponentNode(None) components = core.get_components() comp_lookup = {} for comp in components: tokens = comp.split('.') parent = root_node path_tokens = [] for token in tokens: path_tokens.append(token) path = '.'.join(path_tokens) node_parent = comp_lookup.get(path) if not node_parent: parent = ComponentNode(path, parent) comp_lookup[path] = parent else: parent = node_parent model = ComponentModel(root_node) self.component_tree.setModel(model) self.expand_tree(root_node, model)
def test_get_components(self): components = core.get_components() self.assertIn('cmt.cqueue.components.file', components)