test/test_console_help.py fixed

This commit is contained in:
Marcelo Glezer 2015-03-18 13:49:33 -03:00
parent 8feebcbf8e
commit 7c75f4d0db
1 changed files with 9 additions and 1 deletions

View File

@ -5,7 +5,14 @@ if os.name == "nt":
import libmproxy.console.help as help import libmproxy.console.help as help
class DummyLoop:
def __init__(self):
self.widget = None
class DummyMaster: class DummyMaster:
def __init__(self):
self.loop = DummyLoop()
def make_view(self): def make_view(self):
pass pass
@ -16,7 +23,8 @@ class TestHelp:
assert h.helptext() assert h.helptext()
def test_keypress(self): def test_keypress(self):
h = help.HelpView(DummyMaster(), "foo", [1, 2, 3]) master = DummyMaster()
h = help.HelpView(master, "foo", [1, 2, 3])
assert not h.keypress((0, 0), "q") assert not h.keypress((0, 0), "q")
assert not h.keypress((0, 0), "?") assert not h.keypress((0, 0), "?")
assert h.keypress((0, 0), "o") == "o" assert h.keypress((0, 0), "o") == "o"