aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2011-02-23 10:54:51 +1300
committerAldo Cortesi <aldo@nullcube.com>2011-02-23 10:54:51 +1300
commit39207ffdd280af854d521f810f6082d42943eefa (patch)
tree1a4407c39504aaf9b11bdfd7d5afb8e61c22a705 /test
parentc80214ba553e28f1ec245be3713cd4a8330dbdb0 (diff)
downloadmitmproxy-39207ffdd280af854d521f810f6082d42943eefa.tar.gz
mitmproxy-39207ffdd280af854d521f810f6082d42943eefa.tar.bz2
mitmproxy-39207ffdd280af854d521f810f6082d42943eefa.zip
Add a way for users to specify header significance in server replay.
Also add the --rheader command-line option to mitmdump to let the user specify an arbitrary number of significant headers. The default is to treat no headers as significant.
Diffstat (limited to 'test')
-rw-r--r--test/test_flow.py23
1 files changed, 19 insertions, 4 deletions
diff --git a/test/test_flow.py b/test/test_flow.py
index 9963ad18..e574f545 100644
--- a/test/test_flow.py
+++ b/test/test_flow.py
@@ -6,7 +6,7 @@ import libpry
class uServerPlaybackState(libpry.AutoTree):
def test_hash(self):
- s = flow.ServerPlaybackState()
+ s = flow.ServerPlaybackState(None)
r = utils.tflow()
r2 = utils.tflow()
@@ -17,8 +17,23 @@ class uServerPlaybackState(libpry.AutoTree):
r.request.path = "voing"
assert s._hash(r) != s._hash(r2)
+ def test_headers(self):
+ s = flow.ServerPlaybackState(["foo"])
+ r = utils.tflow_full()
+ r.request.headers["foo"] = ["bar"]
+ r2 = utils.tflow_full()
+ assert not s._hash(r) == s._hash(r2)
+ r2.request.headers["foo"] = ["bar"]
+ assert s._hash(r) == s._hash(r2)
+ r2.request.headers["oink"] = ["bar"]
+ assert s._hash(r) == s._hash(r2)
+
+ r = utils.tflow_full()
+ r2 = utils.tflow_full()
+ assert s._hash(r) == s._hash(r2)
+
def test_load(self):
- s = flow.ServerPlaybackState()
+ s = flow.ServerPlaybackState(None)
r = utils.tflow_full()
r.request.headers["key"] = ["one"]
@@ -319,10 +334,10 @@ class uFlowMaster(libpry.AutoTree):
fm = flow.FlowMaster(None, s)
assert not fm.do_playback(utils.tflow())
- fm.start_playback(pb, False)
+ fm.start_playback(pb, False, [])
assert fm.do_playback(utils.tflow())
- fm.start_playback(pb, False)
+ fm.start_playback(pb, False, [])
r = utils.tflow()
r.request.content = "gibble"
assert not fm.do_playback(r)