aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_custom_contentview.py
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2016-02-15 14:58:46 +0100
committerMaximilian Hils <git@maximilianhils.com>2016-02-15 14:58:46 +0100
commit33fa49277a821b9d38e8c9bf0bcf2adcfa2f6f04 (patch)
tree31914a601302579ff817504019296fd7e9e46765 /test/test_custom_contentview.py
parent36f34f701991b5d474c005ec45e3b66e20f326a8 (diff)
downloadmitmproxy-33fa49277a821b9d38e8c9bf0bcf2adcfa2f6f04.tar.gz
mitmproxy-33fa49277a821b9d38e8c9bf0bcf2adcfa2f6f04.tar.bz2
mitmproxy-33fa49277a821b9d38e8c9bf0bcf2adcfa2f6f04.zip
move mitmproxy
Diffstat (limited to 'test/test_custom_contentview.py')
-rw-r--r--test/test_custom_contentview.py48
1 files changed, 0 insertions, 48 deletions
diff --git a/test/test_custom_contentview.py b/test/test_custom_contentview.py
deleted file mode 100644
index adc4109b..00000000
--- a/test/test_custom_contentview.py
+++ /dev/null
@@ -1,48 +0,0 @@
-import libmproxy.contentviews as cv
-from netlib.http import Headers
-
-
-def test_custom_views():
- class ViewNoop(cv.View):
- name = "noop"
- prompt = ("noop", "n")
- content_types = ["text/none"]
-
- def __call__(self, data, **metadata):
- return "noop", cv.format_text(data)
-
- view_obj = ViewNoop()
-
- cv.add(view_obj)
-
- assert cv.get("noop")
-
- r = cv.get_content_view(
- cv.get("noop"),
- "[1, 2, 3]",
- headers=Headers(
- content_type="text/plain"
- )
- )
- assert "noop" in r[0]
-
- # now try content-type matching
- r = cv.get_content_view(
- cv.get("Auto"),
- "[1, 2, 3]",
- headers=Headers(
- content_type="text/none"
- )
- )
- 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]