aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_console_help.py
blob: 32d94247cd5c027a31777efabf511e40b4dac2ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import os
from unittest.case import SkipTest
if os.name == "nt":
    raise SkipTest("Skipped on Windows.")

import libmproxy.console.help as help


class DummyLoop:

    def __init__(self):
        self.widget = None


class DummyMaster:

    def __init__(self):
        self.loop = DummyLoop()

    def make_view(self):
        pass


class TestHelp:

    def test_helptext(self):
        h = help.HelpView(None)
        assert h.helptext()

    def test_keypress(self):
        master = DummyMaster()
        h = help.HelpView([1, 2, 3])
        assert not h.keypress((0, 0), "q")
        assert not h.keypress((0, 0), "?")
        assert h.keypress((0, 0), "o") == "o"