aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2012-11-26 13:25:07 +1300
committerAldo Cortesi <aldo@nullcube.com>2012-11-26 13:25:07 +1300
commit8c976ac7f0f17f617d483827a8b53b01ddf5d398 (patch)
tree61f9f1c7a86ec2d33037b809c0ed5dea20730797 /test
parent64bf97bfb06dccf4d848468b65093330d5eaf63b (diff)
downloadmitmproxy-8c976ac7f0f17f617d483827a8b53b01ddf5d398.tar.gz
mitmproxy-8c976ac7f0f17f617d483827a8b53b01ddf5d398.tar.bz2
mitmproxy-8c976ac7f0f17f617d483827a8b53b01ddf5d398.zip
Substantially rewrite AMF decoding.
This is tricky, but we should now handle a lot more corner-cases.
Diffstat (limited to 'test')
-rw-r--r--test/data/amf01 (renamed from test/data/test.amf)bin432 -> 432 bytes
-rw-r--r--test/data/amf02bin0 -> 286 bytes
-rw-r--r--test/data/amf03bin0 -> 33691 bytes
-rw-r--r--test/test_console_contentview.py31
4 files changed, 22 insertions, 9 deletions
diff --git a/test/data/test.amf b/test/data/amf01
index c8fc261d..c8fc261d 100644
--- a/test/data/test.amf
+++ b/test/data/amf01
Binary files differ
diff --git a/test/data/amf02 b/test/data/amf02
new file mode 100644
index 00000000..ba69f130
--- /dev/null
+++ b/test/data/amf02
Binary files differ
diff --git a/test/data/amf03 b/test/data/amf03
new file mode 100644
index 00000000..d9fa736a
--- /dev/null
+++ b/test/data/amf03
Binary files differ
diff --git a/test/test_console_contentview.py b/test/test_console_contentview.py
index 4ebef95b..8a5dabb8 100644
--- a/test/test_console_contentview.py
+++ b/test/test_console_contentview.py
@@ -3,6 +3,12 @@ import libmproxy.console.contentview as cv
from libmproxy import utils, flow, encoding
import tutils
+try:
+ import pyamf
+except ImportError:
+ pyamf = None
+
+
class TestContentView:
def test_trailer(self):
txt = []
@@ -119,15 +125,6 @@ class TestContentView:
assert not v([], "flibble", sys.maxint)
- def test_view_amf(self):
- try:
- import pyamf
- v = cv.ViewAMF()
- p = tutils.test_data.path("data/test.amf")
- assert v([], file(p).read(), sys.maxint)
- except ImportError:
- pass
-
def test_view_multipart(self):
view = cv.ViewMultipart()
v = """
@@ -220,5 +217,21 @@ Larry
assert "Raw" in r[0]
+if pyamf:
+ def test_view_amf_request():
+ v = cv.ViewAMF()
+
+ p = tutils.test_data.path("data/amf01")
+ assert v([], file(p).read(), sys.maxint)
+
+ p = tutils.test_data.path("data/amf02")
+ assert v([], file(p).read(), sys.maxint)
+
+ def test_view_amf_response():
+ v = cv.ViewAMF()
+ p = tutils.test_data.path("data/amf03")
+ assert v([], file(p).read(), sys.maxint)
+
+
def test_get_by_shortcut():
assert cv.get_by_shortcut("h")