aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_console_contentview.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2012-04-02 10:30:35 +1200
committerAldo Cortesi <aldo@nullcube.com>2012-04-02 10:30:35 +1200
commit15cc09f1b8d49ce57918acbfe8fd249a4977b036 (patch)
tree9696bc74f488a9a18d2e819ee17329b12c5b46f6 /test/test_console_contentview.py
parent7fef0ecdf5618d06e78ee8f833525d7784234df8 (diff)
downloadmitmproxy-15cc09f1b8d49ce57918acbfe8fd249a4977b036.tar.gz
mitmproxy-15cc09f1b8d49ce57918acbfe8fd249a4977b036.tar.bz2
mitmproxy-15cc09f1b8d49ce57918acbfe8fd249a4977b036.zip
Start rationalizing content views.
We now no longer have distinction between "pretty" view and hex/raw. Instead, we simply a default AUTO view with a global override (M) and a local override (m).
Diffstat (limited to 'test/test_console_contentview.py')
-rw-r--r--test/test_console_contentview.py34
1 files changed, 11 insertions, 23 deletions
diff --git a/test/test_console_contentview.py b/test/test_console_contentview.py
index cc8645df..28265dec 100644
--- a/test/test_console_contentview.py
+++ b/test/test_console_contentview.py
@@ -12,24 +12,21 @@ class uContentView(libpry.AutoTree):
def test_get_view_func(self):
f = cv.get_view_func(
- cv.VIEW_CONTENT_HEX,
- cv.VIEW_CONTENT_PRETTY_TYPE_AUTO,
+ cv.VIEW_HEX,
flow.ODictCaseless(),
"foo"
)
assert f is cv.view_hex
f = cv.get_view_func(
- cv.VIEW_CONTENT_RAW,
- cv.VIEW_CONTENT_PRETTY_TYPE_AUTO,
+ cv.VIEW_AUTO,
flow.ODictCaseless(),
"foo"
)
assert f is cv.view_raw
f = cv.get_view_func(
- cv.VIEW_CONTENT_PRETTY,
- cv.VIEW_CONTENT_PRETTY_TYPE_AUTO,
+ cv.VIEW_AUTO,
flow.ODictCaseless(
[["content-type", "text/html"]],
),
@@ -38,8 +35,7 @@ class uContentView(libpry.AutoTree):
assert f is cv.view_xmlish
f = cv.get_view_func(
- cv.VIEW_CONTENT_PRETTY,
- cv.VIEW_CONTENT_PRETTY_TYPE_AUTO,
+ cv.VIEW_AUTO,
flow.ODictCaseless(
[["content-type", "text/flibble"]],
),
@@ -48,8 +44,7 @@ class uContentView(libpry.AutoTree):
assert f is cv.view_raw
f = cv.get_view_func(
- cv.VIEW_CONTENT_PRETTY,
- cv.VIEW_CONTENT_PRETTY_TYPE_AUTO,
+ cv.VIEW_AUTO,
flow.ODictCaseless(
[["content-type", "text/flibble"]],
),
@@ -118,33 +113,28 @@ Larry
def test_get_content_view(self):
r = cv.get_content_view(
- cv.VIEW_CONTENT_RAW,
- cv.VIEW_CONTENT_PRETTY_TYPE_AUTO,
+ cv.VIEW_RAW,
[["content-type", "application/json"]],
"[1, 2, 3]"
)
- assert r[0] == "Raw"
+ assert "Raw" in r[0]
r = cv.get_content_view(
- cv.VIEW_CONTENT_PRETTY,
- cv.VIEW_CONTENT_PRETTY_TYPE_AUTO,
+ cv.VIEW_AUTO,
[["content-type", "application/json"]],
"[1, 2, 3]"
)
assert r[0] == "JSON"
-
r = cv.get_content_view(
- cv.VIEW_CONTENT_PRETTY,
- cv.VIEW_CONTENT_PRETTY_TYPE_AUTO,
+ cv.VIEW_AUTO,
[["content-type", "application/json"]],
"[1, 2"
)
assert r[0] == "Raw"
r = cv.get_content_view(
- cv.VIEW_CONTENT_PRETTY,
- cv.VIEW_CONTENT_PRETTY_TYPE_AUTO,
+ cv.VIEW_AUTO,
[
["content-type", "application/json"],
["content-encoding", "gzip"]
@@ -154,10 +144,8 @@ Larry
assert "decoded gzip" in r[0]
assert "JSON" in r[0]
-
r = cv.get_content_view(
- cv.VIEW_CONTENT_PRETTY,
- cv.VIEW_CONTENT_PRETTY_TYPE_XML,
+ cv.VIEW_XML,
[
["content-type", "application/json"],
["content-encoding", "gzip"]