コード例 #1
0
ファイル: test_rolex.py プロジェクト: hut8labs/rolex
def test_watch_panes_for_command(curses_mock):
    cmd1 = Command('test1', 1, Mock())
    cmd2 = Command('test2', 2, Mock())
    watch = Watch(Mock(height=20, width=80), Mock(), [cmd1, cmd2], Mock())

    eq_([watch.panes[0]], list(watch.panes_for_command(cmd1)))
    eq_([watch.panes[1]], list(watch.panes_for_command(cmd2)))
コード例 #2
0
ファイル: test_rolex.py プロジェクト: hut8labs/rolex
def test_watch_set_selected(curses_mock):
    cmd1 = Command('test1', 1, Mock())
    cmd2 = Command('test2', 2, Mock())
    watch = Watch(Mock(height=20, width=80), Mock(), [cmd1, cmd2], Mock())

    eq_(True, watch.panes[0].selected)
    eq_(False, watch.panes[1].selected)

    watch.set_selected_from_key(ord('1'))

    eq_(True, watch.panes[0].selected)
    eq_(False, watch.panes[1].selected)

    watch.set_selected_from_key(ord('2'))

    eq_(False, watch.panes[0].selected)
    eq_(True, watch.panes[1].selected)
コード例 #3
0
ファイル: test_rolex.py プロジェクト: hut8labs/rolex
def test_watch_remove_pane_mirrored(curses_mock):
    cmd1 = Command('test1', 1, Mock())
    watch = Watch(Mock(height=20, width=80), Mock(), [cmd1], Mock())
    rolex.cmd_mirror_command(watch, Mock())

    eq_(2, len(watch.panes))
    eq_(2, len(watch.pane_map))
    eq_(1, len(watch.commands))
    eq_(True, 0 in watch.pane_map)
    eq_(True, 1 in watch.pane_map)
    eq_(False, watch.panes[1].selected)
    eq_(cmd1, watch.pane_map[1])

    watch.remove_pane(watch.panes[0])

    eq_(1, len(watch.panes))
    eq_(1, len(watch.pane_map))
    eq_(1, len(watch.commands))
    eq_(True, 0 in watch.pane_map)
    eq_(False, 1 in watch.pane_map)
    eq_(cmd1, watch.pane_map[0])
    eq_(True, watch.panes[0].selected)
コード例 #4
0
ファイル: test_rolex.py プロジェクト: hut8labs/rolex
def test_watch_remove_pane(curses_mock):
    cmd1 = Command('test1', 1, Mock())
    cmd2 = Command('test2', 2, Mock())
    watch = Watch(Mock(height=20, width=80), Mock(), [cmd1, cmd2], Mock())

    eq_(2, len(watch.panes))
    eq_(2, len(watch.pane_map))
    eq_(2, len(watch.commands))
    eq_(True, 0 in watch.pane_map)
    eq_(True, 1 in watch.pane_map)
    eq_(False, watch.panes[1].selected)
    eq_(cmd2, watch.pane_map[1])

    watch.remove_pane(watch.panes[0])

    eq_(1, len(watch.panes))
    eq_(1, len(watch.pane_map))
    eq_(1, len(watch.commands))
    eq_(True, 0 in watch.pane_map)
    eq_(False, 1 in watch.pane_map)
    eq_(cmd2, watch.pane_map[0])
    eq_(True, watch.panes[0].selected)