diff options
| author | Maximilian Hils <git@maximilianhils.com> | 2014-01-29 02:49:11 +0100 | 
|---|---|---|
| committer | Maximilian Hils <git@maximilianhils.com> | 2014-01-29 02:49:11 +0100 | 
| commit | 607f7778110d5c2720e60ffcf5f4b0c94e8fcc5f (patch) | |
| tree | cd6249109b49936267cee0a30e0cb616288417d0 /test/test_proxy.py | |
| parent | 1e3e0dd1271afda59ec244b64391b6579a998dce (diff) | |
| download | mitmproxy-607f7778110d5c2720e60ffcf5f4b0c94e8fcc5f.tar.gz mitmproxy-607f7778110d5c2720e60ffcf5f4b0c94e8fcc5f.tar.bz2 mitmproxy-607f7778110d5c2720e60ffcf5f4b0c94e8fcc5f.zip  | |
fix most testsuite errors, improve proxy error handling
Diffstat (limited to 'test/test_proxy.py')
| -rw-r--r-- | test/test_proxy.py | 13 | 
1 files changed, 7 insertions, 6 deletions
diff --git a/test/test_proxy.py b/test/test_proxy.py index 371e5ef7..737e4a92 100644 --- a/test/test_proxy.py +++ b/test/test_proxy.py @@ -19,25 +19,26 @@ class TestServerConnection:          self.d.shutdown()      def test_simple(self): -        sc = proxy.ServerConnection(proxy.ProxyConfig(), "http", self.d.IFACE, self.d.port, "host.com") +        sc = proxy.ServerConnection((self.d.IFACE, self.d.port))          sc.connect()          r = tutils.treq()          r.path = "/p/200:da" -        sc.send(r) +        sc.send(r._assemble())          assert http.read_response(sc.rfile, r.method, 1000)          assert self.d.last_log()          r.content = flow.CONTENT_MISSING -        tutils.raises("incomplete request", sc.send, r) +        tutils.raises("incomplete request", sc.send, r._assemble()) -        sc.terminate() +        sc.finish()      def test_terminate_error(self): -        sc = proxy.ServerConnection(proxy.ProxyConfig(), "http", self.d.IFACE, self.d.port, "host.com") +        sc = proxy.ServerConnection((self.d.IFACE, self.d.port))          sc.connect()          sc.connection = mock.Mock() +        sc.connection.recv = mock.Mock(return_value=False)          sc.connection.flush = mock.Mock(side_effect=tcp.NetLibDisconnect) -        sc.terminate() +        sc.finish()  class MockParser:  | 
