diff options
author | Chris Czub <chris.czub@gmail.com> | 2015-11-13 16:55:27 -0500 |
---|---|---|
committer | Chris Czub <chris.czub@gmail.com> | 2015-11-13 16:55:27 -0500 |
commit | e72a9a62a107ea3f53b6b26d1abe63c554448d17 (patch) | |
tree | 6631b484b9029b8391d22a6bf22845058f4f2fce /test | |
parent | d3feaa3bc6e2d9c2c7ee8286038c69c0b9601869 (diff) | |
download | mitmproxy-e72a9a62a107ea3f53b6b26d1abe63c554448d17.tar.gz mitmproxy-e72a9a62a107ea3f53b6b26d1abe63c554448d17.tar.bz2 mitmproxy-e72a9a62a107ea3f53b6b26d1abe63c554448d17.zip |
Feedback from PR #832
Diffstat (limited to 'test')
-rw-r--r-- | test/test_contentview.py | 1 | ||||
-rw-r--r-- | test/test_custom_contentview.py | 29 | ||||
-rw-r--r-- | test/test_script.py | 9 |
3 files changed, 17 insertions, 22 deletions
diff --git a/test/test_contentview.py b/test/test_contentview.py index c1e437e4..eba624a2 100644 --- a/test/test_contentview.py +++ b/test/test_contentview.py @@ -213,6 +213,7 @@ Larry def test_add_cv(self): class TestContentView(cv.View): name = "test" + prompt = ("t", "test") tcv = TestContentView() cv.add(tcv) diff --git a/test/test_custom_contentview.py b/test/test_custom_contentview.py index 2ca184d0..4b5a3e53 100644 --- a/test/test_custom_contentview.py +++ b/test/test_custom_contentview.py @@ -4,14 +4,6 @@ from netlib.http import Headers def test_custom_views(): - plugins = flow.Plugins() - - # two types: view and action - assert 'view_plugins' in dict(plugins).keys() - - view_plugins = plugins['view_plugins'] - assert len(view_plugins) == 0 - class ViewNoop(cv.View): name = "noop" prompt = ("noop", "n") @@ -20,12 +12,10 @@ def test_custom_views(): def __call__(self, data, **metadata): return "noop", cv.format_text(data) - plugins.register_view('noop', - title='Noop View Plugin', - class_ref=ViewNoop) - assert len(view_plugins) == 1 - assert view_plugins['noop']['title'] == 'Noop View Plugin' + view_obj = ViewNoop() + + cv.add(view_obj) assert cv.get("noop") @@ -47,3 +37,16 @@ def test_custom_views(): ) ) assert "noop" in r[0] + + # now try removing the custom view + cv.remove(view_obj) + r = cv.get_content_view( + cv.get("Auto"), + "[1, 2, 3]", + headers=Headers( + content_type="text/none" + ) + ) + assert "noop" not in r[0] + + diff --git a/test/test_script.py b/test/test_script.py index f0883ad5..8612d5f3 100644 --- a/test/test_script.py +++ b/test/test_script.py @@ -128,12 +128,3 @@ def test_command_parsing(): s = script.Script(absfilepath, fm) assert os.path.isfile(s.args[0]) - -def test_script_plugins(): - s = flow.State() - fm = flow.FlowMaster(None, s) - sp = tutils.test_data.path("scripts/a.py") - p = script.Script("%s --var 40" % sp, fm) - - assert hasattr(p.ctx, 'plugins') - |