diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2012-07-09 11:03:55 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2012-07-09 11:03:55 +1200 |
commit | aab45078adfdf143722aa021c7d7ad1b2eb61ed3 (patch) | |
tree | bf93d7ab77cd79c32305ffd81950157d80fdd9e6 | |
parent | e49c920d161fcd1a4bc75ba981ffabd188dd0f00 (diff) | |
download | mitmproxy-aab45078adfdf143722aa021c7d7ad1b2eb61ed3.tar.gz mitmproxy-aab45078adfdf143722aa021c7d7ad1b2eb61ed3.tar.bz2 mitmproxy-aab45078adfdf143722aa021c7d7ad1b2eb61ed3.zip |
Unit test request replay thread.
This is a small patch, but is the culmination of lots of work: we can now unit
test the deep innards of mitmproxy, with coverage. There's a lot more to come
in this vein.
-rw-r--r-- | libmproxy/flow.py | 1 | ||||
-rw-r--r-- | test/test_server.py | 10 |
2 files changed, 11 insertions, 0 deletions
diff --git a/libmproxy/flow.py b/libmproxy/flow.py index 17e88bc1..53644fb1 100644 --- a/libmproxy/flow.py +++ b/libmproxy/flow.py @@ -1382,6 +1382,7 @@ class FlowMaster(controller.Master): self.masterq, ) rt.start() # pragma: no cover + return rt def run_script_hook(self, name, *args, **kwargs): if self.script and not self.pause_scripts: diff --git a/test/test_server.py b/test/test_server.py index 87996c43..a500d81c 100644 --- a/test/test_server.py +++ b/test/test_server.py @@ -20,6 +20,16 @@ class SanityMixin: def test_large(self): assert len(self.pathod("200:b@50k").content) == 1024*50 + def test_replay(self): + assert self.pathod("304").status_code == 304 + assert len(self.master.state.view) == 1 + l = self.master.state.view[0] + assert l.response.code == 304 + l.request.path = "/p/305" + rt = self.master.replay_request(l) + rt.join() + assert l.response.code == 305 + class TestHTTP(tutils.HTTPProxTest, SanityMixin): def test_invalid_http(self): |