def set_additional_tenants(view, tenants): """ Sets additional tenants Args: view: AddCatalogItemView or EditCatalogItemView tenants: list of tenants with options to select Usage: set True to the path which needs to be checked and False for the path that needs to be unchecked catalog_item = appliance.collections.catalog_items.create( catalog_item_class, additional_tenants=[ (("All Tenants"), False), (("All Tenants", "My Company"), True), (("All Tenants", "My Company", "Child", "Grandchild"), True), ], *args, **kwargs ) """ if tenants is not None and isinstance(tenants, (list, tuple, set)): changes = [ view.fill({ "additional_tenants": CheckableBootstrapTreeview.CheckNode(path) if option else CheckableBootstrapTreeview.UncheckNode(path) }) for path, option in tenants ] return True in changes else: return False
def update(self, updates): """ Args: updates: Dictionary containing 'filters' key. Values are tuples of ([path], bool) Where bool is whether to check or uncheck the filter Returns: None """ view = navigate_to(self, 'All') for path, check in updates['filters']: fill_value = CbTree.CheckNode( path) if check else CbTree.UncheckNode(path) if view.tree.fill(fill_value): view.save.click() else: logger.info('No change to filter on update, not saving form.')