コード例 #1
0
ファイル: test_rolex.py プロジェクト: hut8labs/rolex
def test_pad_draw_header_with_diff(curses_mock, time_mock):
    time_mock.ctime.return_value = ctime = 'Tue Mar 25 21:00:00 2014'
    layout = EvenVerticalLayout()
    command = Command('test', 1, Mock())
    pane = Pane(0, 25, 80, layout)
    pane.show_diffs = True
    pane.draw_header(command)
    curses_mock.newpad().addstr.assert_has_calls([
        call(0, 0, ANY, ANY),
        call(0, 2, '1', ANY),
        call(0, 4, 'test', curses_mock.color_pair(3)),
        call(0, 9, 'diff last', curses_mock.color_pair(1)),
        call(0, 55, ctime)
    ])
    curses_mock.reset()

    command.mark = 'test'
    pane.draw_header(command)
    curses_mock.newpad().addstr.assert_has_calls([
        call(0, 0, ANY, ANY),
        call(0, 2, '1', ANY),
        call(0, 4, 'test', curses_mock.color_pair(3)),
        call(0, 9, 'diff mark', curses_mock.color_pair(1)),
        call(0, 55, ctime)
    ])
コード例 #2
0
ファイル: test_rolex.py プロジェクト: hut8labs/rolex
def test_cmd_toggle_diffs(curses_mock):
    cmd1 = Command('test1', 1, Mock())
    cmd2 = Command('test2', 2, Mock())
    watch = Watch(Mock(height=20, width=80), Mock(), [cmd1, cmd2], Mock())

    cmd1.mark = Mock()
    watch.panes[0].show_diffs = True

    rolex.cmd_toggle_diffs(watch, None)

    eq_(None, cmd1.mark)
    eq_(False, watch.panes[0].show_diffs)

    rolex.cmd_toggle_diffs(watch, None)

    eq_(None, cmd1.mark)
    eq_(True, watch.panes[0].show_diffs)