Пример #1
0
def test_single_pane_window(capsys):
    """
    Test the creation of a basic single-pane window
    """
    builder = TmuxBuilder("session", "/etc")
    builder.add_window("win1", "pane1", "window", "/home")
    builder.run_command("top")
    actual = convert_lines_to_object(builder.build().split("\n"))

    expected = convert_lines_to_object(
        [
            'pushd "/etc"',
            "tmux new-session -d -s session \\; \\",
            "rename-window window \\; \\",
            'send-keys "top" "C-m"',
            "popd",
        ]
    )

    assert_objects_equal(expected, actual, expected.keys(), capsys)
Пример #2
0
def test_two_split_panes(capsys):
    """
    Test two windows, both with split panes
    """
    builder = TmuxBuilder("session", "/var")
    builder.add_window("win1", "pane1", "window")
    builder.add_pane("pane2", SPLIT_HORIZONTAL)
    builder.run_command("top")
    builder.run_command("echo", "win1", "pane1")
    builder.add_window("win2", "pane3", "window2", "/home")
    builder.add_pane("pane4", SPLIT_VERTICAL, working_directory="/etc")
    builder.run_command("tail")
    actual = convert_lines_to_object(builder.build().split("\n"))

    expected = convert_lines_to_object(
        [
            'pushd "/var"',
            "tmux new-session -d -s session \\; \\",
            "rename-window window \\; \\",
            'send-keys "echo" "C-m" \\; \\',
            'split-window -h -c "/var" \\; \\',
            'send-keys "top" "C-m" \\; \\',
            'new-window -n window2 -c "/home" \\; \\',
            'split-window -v -c "/etc" \\; \\',
            'send-keys "tail" "C-m"',
            "popd",
        ]
    )

    assert_objects_equal(expected, actual, expected.keys(), capsys)
Пример #3
0
def test_two_window_single_pane(capsys):
    """
    Test two windows with single panes
    """
    builder = TmuxBuilder("session", "/var")
    builder.add_window("win1", "pane1", "window")
    builder.run_command("top")
    builder.add_window("win2", "pane2", "window2", "/home")
    builder.run_command("tail")
    actual = convert_lines_to_object(builder.build().split("\n"))

    expected = convert_lines_to_object(
        [
            'pushd "/var"',
            "tmux new-session -d -s session \\; \\",
            "rename-window window \\; \\",
            'send-keys "top" "C-m" \\; \\',
            'new-window -n window2 -c "/home" \\; \\',
            'send-keys "tail" "C-m"',
            "popd",
        ]
    )

    assert_objects_equal(expected, actual, expected.keys(), capsys)