Ejemplo n.º 1
0
def test_shuffle_first_level(group, on_finish_default):
    # Find a folder
    pytest.sel.force_navigate("reports")
    tree = accordion.tree("Reports").read_contents()
    folders = Tree.browse(tree, "All Reports")
    # Select some folder that has at least 3 children
    folders = map(lambda item: item[0],
                filter(lambda item: isinstance(item[1], list) and len(item[1]) >= 3, folders))
    selected_folder = random.choice(folders)
    # Shuffle the order
    with menus.manage_folder(group, selected_folder) as folder:
        order = shuffle(folder.fields)
        for item in reversed(order):
            folder.move_first(item)
    # Now go and read the tree
    pytest.sel.force_navigate("reports")
    tree = accordion.tree("Reports").read_contents()
    checked = Tree.flatten_level(Tree.browse(tree, "All Reports", selected_folder))
    assert checked == order, "The order differs!"
Ejemplo n.º 2
0
def test_shuffle_top_level(group, on_finish_default):
    # Shuffle the order
    with menus.manage_folder(group) as folder:
        order = shuffle(folder.fields)
        for item in reversed(order):
            folder.move_first(item)
    # Now go and read the tree
    pytest.sel.force_navigate("reports")
    tree = accordion.tree("Reports").read_contents()
    checked = Tree.flatten_level(Tree.browse(tree, "All Reports"))
    assert checked == order, "The order differs!"