diff options
| author | Aldo Cortesi <aldo@nullcube.com> | 2012-02-10 15:55:58 +1300 | 
|---|---|---|
| committer | Aldo Cortesi <aldo@nullcube.com> | 2012-02-10 15:55:58 +1300 | 
| commit | da1ccfddeb38c534e8d511c45980783af76716c2 (patch) | |
| tree | e3b3af824d97aada4010209af9510f6b7de5f6ec | |
| parent | 1ad7e9152736251203cd9c57c6af3e19a2f7ad8a (diff) | |
| download | mitmproxy-da1ccfddeb38c534e8d511c45980783af76716c2.tar.gz mitmproxy-da1ccfddeb38c534e8d511c45980783af76716c2.tar.bz2 mitmproxy-da1ccfddeb38c534e8d511c45980783af76716c2.zip  | |
100% test coverage for flow.py
| -rw-r--r-- | test/scripts/reqerr.py | 2 | ||||
| -rw-r--r-- | test/test_flow.py | 14 | 
2 files changed, 16 insertions, 0 deletions
diff --git a/test/scripts/reqerr.py b/test/scripts/reqerr.py new file mode 100644 index 00000000..e7c503a8 --- /dev/null +++ b/test/scripts/reqerr.py @@ -0,0 +1,2 @@ +def request(ctx, r): +    raise ValueError diff --git a/test/test_flow.py b/test/test_flow.py index 5a8eb0f2..45daf0c5 100644 --- a/test/test_flow.py +++ b/test/test_flow.py @@ -453,9 +453,19 @@ class uFlowMaster(libpry.AutoTree):          s = flow.State()          fm = flow.FlowMaster(None, s)          assert not fm.load_script("scripts/a.py") +        assert not fm.load_script("scripts/a.py") +        assert not fm.load_script(None)          assert fm.load_script("nonexistent")          assert "ValueError" in fm.load_script("scripts/starterr.py") +    def test_script_reqerr(self): +        s = flow.State() +        fm = flow.FlowMaster(None, s) +        assert not fm.load_script("scripts/reqerr.py") +        req = tutils.treq() +        fm.handle_clientconnect(req.client_conn) +        f = fm.handle_request(req) +      def test_script(self):          s = flow.State()          fm = flow.FlowMaster(None, s) @@ -494,11 +504,15 @@ class uFlowMaster(libpry.AutoTree):          assert not fm.handle_response(rx)          dc = flow.ClientDisconnect(req.client_conn) +        req.client_conn.requestcount = 1          fm.handle_clientdisconnect(dc)          err = flow.Error(f.request, "msg")          fm.handle_error(err) +        fm.load_script("scripts/a.py") +        fm.shutdown() +      def test_client_playback(self):          s = flow.State()  | 
