From 8c976ac7f0f17f617d483827a8b53b01ddf5d398 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Mon, 26 Nov 2012 13:25:07 +1300 Subject: Substantially rewrite AMF decoding. This is tricky, but we should now handle a lot more corner-cases. --- test/test_console_contentview.py | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) (limited to 'test/test_console_contentview.py') 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") -- cgit v1.2.3