diff options
author | Maximilian Hils <git@maximilianhils.com> | 2015-03-19 16:18:41 +0100 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2015-03-19 16:18:41 +0100 |
commit | 51856b7ccde424828dfb6f12b186478cd07f4dd8 (patch) | |
tree | 57a51cb6f98fd1d23c5329f8a458d29a3d5e200c /test | |
parent | a2cbfb117b5b92b4c756ad6054deec76ce6f807d (diff) | |
parent | b47019293e49f85186bc7a7c8e71ab4c253b7d99 (diff) | |
download | mitmproxy-51856b7ccde424828dfb6f12b186478cd07f4dd8.tar.gz mitmproxy-51856b7ccde424828dfb6f12b186478cd07f4dd8.tar.bz2 mitmproxy-51856b7ccde424828dfb6f12b186478cd07f4dd8.zip |
Merge branch 'master' of github.com:mitmproxy/mitmproxy
Diffstat (limited to 'test')
-rw-r--r-- | test/test_console_help.py | 10 | ||||
-rw-r--r-- | test/test_console_palettes.py | 11 | ||||
-rw-r--r-- | test/test_dump.py | 7 | ||||
-rwxr-xr-x | test/tools/testpatt | 9 |
4 files changed, 33 insertions, 4 deletions
diff --git a/test/test_console_help.py b/test/test_console_help.py index 6e1f9fad..a410bd2e 100644 --- a/test/test_console_help.py +++ b/test/test_console_help.py @@ -5,7 +5,14 @@ if os.name == "nt": 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 @@ -16,7 +23,8 @@ class TestHelp: assert h.helptext() 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), "?") assert h.keypress((0, 0), "o") == "o" diff --git a/test/test_console_palettes.py b/test/test_console_palettes.py new file mode 100644 index 00000000..3f8e280a --- /dev/null +++ b/test/test_console_palettes.py @@ -0,0 +1,11 @@ +import os +from nose.plugins.skip import SkipTest +if os.name == "nt": + raise SkipTest("Skipped on Windows.") +import libmproxy.console.palettes as palettes + + +class TestPalette: + def test_helptext(self): + for i in palettes.palettes.values(): + assert i.palette() diff --git a/test/test_dump.py b/test/test_dump.py index 11a024e3..48eeb244 100644 --- a/test/test_dump.py +++ b/test/test_dump.py @@ -131,14 +131,16 @@ class TestDumpMaster: assert len(m.apps.apps) == 1 def test_replacements(self): + cs = StringIO() o = dump.Options(replacements=[(".*", "content", "foo")]) - m = dump.DumpMaster(None, o) + m = dump.DumpMaster(None, o, outfile=cs) f = self._cycle(m, "content") assert f.request.content == "foo" def test_setheader(self): + cs = StringIO() o = dump.Options(setheaders=[(".*", "one", "two")]) - m = dump.DumpMaster(None, o) + m = dump.DumpMaster(None, o, outfile=cs) f = self._cycle(m, "content") assert f.request.headers["one"] == ["two"] @@ -195,4 +197,3 @@ class TestDumpMaster: def test_stickyauth(self): self._dummy_cycle(1, None, "", stickyauth = ".*") - diff --git a/test/tools/testpatt b/test/tools/testpatt new file mode 100755 index 00000000..f6d1169b --- /dev/null +++ b/test/tools/testpatt @@ -0,0 +1,9 @@ +#!/bin/bash + +# Generate a test pattern with pathoc +PATHOD=http://localhost:9999 +pathoc localhost:8080 "get:'$PATHOD/p/200:p0,1:b@200b'" +pathoc localhost:8080 "get:'$PATHOD/p/300:p0,1:b@200b'" +pathoc localhost:8080 "get:'$PATHOD/p/400:p0,1:b@200b'" +pathoc localhost:8080 "get:'$PATHOD/p/500:p0,1:b@200b'" +pathoc localhost:8080 "get:'$PATHOD/p/600:p0,1:b@200b'" |