2013-06-17 14:48:06 +00:00
|
|
|
import os
|
|
|
|
from nose.plugins.skip import SkipTest
|
|
|
|
if os.name == "nt":
|
|
|
|
raise SkipTest("Skipped on Windows.")
|
|
|
|
|
2012-06-03 08:11:07 +00:00
|
|
|
import libmproxy.console.help as help
|
|
|
|
|
2015-03-18 16:49:33 +00:00
|
|
|
class DummyLoop:
|
|
|
|
def __init__(self):
|
|
|
|
self.widget = None
|
|
|
|
|
2012-06-03 08:11:07 +00:00
|
|
|
class DummyMaster:
|
2015-03-18 16:49:33 +00:00
|
|
|
def __init__(self):
|
|
|
|
self.loop = DummyLoop()
|
|
|
|
|
2012-06-03 08:11:07 +00:00
|
|
|
def make_view(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
2012-06-09 01:42:43 +00:00
|
|
|
class TestHelp:
|
2012-06-03 08:11:07 +00:00
|
|
|
def test_helptext(self):
|
|
|
|
h = help.HelpView(None, "foo", None)
|
|
|
|
assert h.helptext()
|
|
|
|
|
|
|
|
def test_keypress(self):
|
2015-03-18 16:49:33 +00:00
|
|
|
master = DummyMaster()
|
|
|
|
h = help.HelpView(master, "foo", [1, 2, 3])
|
2012-06-03 08:11:07 +00:00
|
|
|
assert not h.keypress((0, 0), "q")
|
|
|
|
assert not h.keypress((0, 0), "?")
|
|
|
|
assert h.keypress((0, 0), "o") == "o"
|