diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2012-02-18 23:56:40 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2012-02-18 23:56:40 +1300 |
commit | 8ddc3b4ef275d70cdbc9bc49add02ea21cca3583 (patch) | |
tree | 8f57ae878938f2e642e6e40589ba3ed982ecd5a1 /test/test_flow.py | |
parent | 5f1d7a07469d9ee12267f79fb1b398145d153bcf (diff) | |
download | mitmproxy-8ddc3b4ef275d70cdbc9bc49add02ea21cca3583.tar.gz mitmproxy-8ddc3b4ef275d70cdbc9bc49add02ea21cca3583.tar.bz2 mitmproxy-8ddc3b4ef275d70cdbc9bc49add02ea21cca3583.zip |
Add API for duplicating flows.
Diffstat (limited to 'test/test_flow.py')
-rw-r--r-- | test/test_flow.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/test_flow.py b/test/test_flow.py index 94c4614d..fe84be53 100644 --- a/test/test_flow.py +++ b/test/test_flow.py @@ -136,6 +136,14 @@ class uServerPlaybackState(libpry.AutoTree): class uFlow(libpry.AutoTree): + def test_copy(self): + f = tutils.tflow_full() + f2 = f.copy() + assert not f is f2 + assert not f.request is f2.request + assert f.request.headers == f2.request.headers + assert not f.request.headers is f2.request.headers + def test_match(self): f = tutils.tflow() f.response = tutils.tresp() @@ -485,6 +493,15 @@ class uFlowMaster(libpry.AutoTree): fm.handle_error(err) assert fm.script.ns["log"][-1] == "error" + def test_duplicate_flow(self): + s = flow.State() + fm = flow.FlowMaster(None, s) + f = tutils.tflow_full() + fm.load_flow(f) + assert s.flow_count() == 1 + f2 = fm.duplicate_flow(f) + assert s.flow_count() == 2 + def test_all(self): s = flow.State() fm = flow.FlowMaster(None, s) @@ -572,6 +589,7 @@ class uFlowMaster(libpry.AutoTree): fm.handle_response(tf.response) assert fm.stickycookie_state.jar assert not "cookie" in tf.request.headers + tf = tf.copy() fm.handle_request(tf.request) assert tf.request.headers["cookie"] == ["foo=bar"] |