aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2011-08-04 10:34:34 +1200
committerAldo Cortesi <aldo@nullcube.com>2011-08-04 10:34:34 +1200
commitb51aac8a865984b65a84c0da3cb155cb3fbb6875 (patch)
treefedd15b450419b8581ec985d8a7a2a7736fe9b99 /test
parent730c78ac53672c4ef2f3d1067aa50e8adeee7f24 (diff)
downloadmitmproxy-b51aac8a865984b65a84c0da3cb155cb3fbb6875.tar.gz
mitmproxy-b51aac8a865984b65a84c0da3cb155cb3fbb6875.tar.bz2
mitmproxy-b51aac8a865984b65a84c0da3cb155cb3fbb6875.zip
Code cleanliness - appease pychecker.
Diffstat (limited to 'test')
-rw-r--r--test/serv.py2
-rw-r--r--test/sslserv.py2
-rw-r--r--test/test_dump.py5
-rw-r--r--test/test_encoding.py1
-rw-r--r--test/test_flow.py10
-rw-r--r--test/test_netstring.py4
-rw-r--r--test/test_proxy.py3
-rw-r--r--test/test_utils.py2
8 files changed, 11 insertions, 18 deletions
diff --git a/test/serv.py b/test/serv.py
index 9e43c08f..53747f08 100644
--- a/test/serv.py
+++ b/test/serv.py
@@ -1,4 +1,4 @@
-import socket, os, cStringIO, tempfile
+import socket
from SocketServer import BaseServer
from BaseHTTPServer import HTTPServer
import handler
diff --git a/test/sslserv.py b/test/sslserv.py
index 5153d0da..4aa4df39 100644
--- a/test/sslserv.py
+++ b/test/sslserv.py
@@ -1,4 +1,4 @@
-import socket, os, cStringIO, tempfile
+import socket
from SocketServer import BaseServer
from BaseHTTPServer import HTTPServer
import ssl
diff --git a/test/test_dump.py b/test/test_dump.py
index 808b3a7e..c5efed62 100644
--- a/test/test_dump.py
+++ b/test/test_dump.py
@@ -70,7 +70,6 @@ class uDumpMaster(libpry.AutoTree):
m = dump.DumpMaster(None, o, None, outfile=cs)
def test_read(self):
- cs = StringIO()
t = self.tmpdir()
p = os.path.join(t, "read")
self._flowfile(p)
@@ -130,10 +129,10 @@ class uDumpMaster(libpry.AutoTree):
)
def test_stickycookie(self):
- ret = self._dummy_cycle(1, None, "", stickycookie = ".*")
+ self._dummy_cycle(1, None, "", stickycookie = ".*")
def test_stickyauth(self):
- ret = self._dummy_cycle(1, None, "", stickyauth = ".*")
+ self._dummy_cycle(1, None, "", stickyauth = ".*")
diff --git a/test/test_encoding.py b/test/test_encoding.py
index d9e6a85c..fe338da1 100644
--- a/test/test_encoding.py
+++ b/test/test_encoding.py
@@ -2,7 +2,6 @@ from libmproxy import encoding
import libpry
import cStringIO
-import gzip, zlib
class uidentity(libpry.AutoTree):
def test_simple(self):
diff --git a/test/test_flow.py b/test/test_flow.py
index fa49aecd..85355b73 100644
--- a/test/test_flow.py
+++ b/test/test_flow.py
@@ -241,7 +241,6 @@ class uFlow(libpry.AutoTree):
class uState(libpry.AutoTree):
def test_backup(self):
- bc = flow.ClientConnect(("address", 22))
c = flow.State()
req = tutils.treq()
f = c.add_request(req)
@@ -285,10 +284,8 @@ class uState(libpry.AutoTree):
assert c.add_response(resp)
assert c.active_flow_count() == 0
- dc = flow.ClientDisconnect(bc)
def test_err(self):
- bc = flow.ClientConnect(("address", 22))
c = flow.State()
req = tutils.treq()
f = c.add_request(req)
@@ -305,7 +302,7 @@ class uState(libpry.AutoTree):
req = tutils.treq()
assert len(c.view) == 0
- f = c.add_request(req)
+ c.add_request(req)
assert len(c.view) == 1
c.set_limit("~s")
@@ -342,7 +339,7 @@ class uState(libpry.AutoTree):
def _add_response(self, state):
req = tutils.treq()
- f = state.add_request(req)
+ state.add_request(req)
resp = tutils.tresp(req)
state.add_response(resp)
@@ -539,7 +536,7 @@ class uFlowMaster(libpry.AutoTree):
tf = tutils.tflow_full()
tf.response.headers["set-cookie"] = ["foo=bar"]
fm.handle_request(tf.request)
- f = fm.handle_response(tf.response)
+ fm.handle_response(tf.response)
assert fm.stickycookie_state.jar
assert not "cookie" in tf.request.headers
fm.handle_request(tf.request)
@@ -690,7 +687,6 @@ class uResponse(libpry.AutoTree):
h = flow.Headers()
h["test"] = ["test"]
c = flow.ClientConnect(("addr", 2222))
- r = flow.Request(c, "host", 22, "https", "GET", "/", h, "content")
req = flow.Request(c, "host", 22, "https", "GET", "/", h, "content")
resp = flow.Response(req, 200, "msg", h.copy(), "content")
diff --git a/test/test_netstring.py b/test/test_netstring.py
index 3c56acd9..5c4f775a 100644
--- a/test/test_netstring.py
+++ b/test/test_netstring.py
@@ -9,10 +9,10 @@ class uNetstring(libpry.AutoTree):
self.encoded_data = "9:Netstring,6:module,2:by,4:Will,7:McGugan,"
def test_header(self):
- tests = [ ("netstring", "9:"),
+ t = [ ("netstring", "9:"),
("Will McGugan", "12:"),
("", "0:") ]
- for test, result in tests:
+ for test, result in t:
assert netstring.header(test) == result
def test_file_encoder(self):
diff --git a/test/test_proxy.py b/test/test_proxy.py
index bb86a6ba..16b6034c 100644
--- a/test/test_proxy.py
+++ b/test/test_proxy.py
@@ -1,7 +1,6 @@
-import cStringIO, time, re
+import cStringIO, time
import libpry
from libmproxy import proxy, controller, utils, dump
-import tutils
class u_read_chunked(libpry.AutoTree):
diff --git a/test/test_utils.py b/test/test_utils.py
index b38c96c1..8b16e057 100644
--- a/test/test_utils.py
+++ b/test/test_utils.py
@@ -40,7 +40,7 @@ class upretty_size(libpry.AutoTree):
def test_simple(self):
assert utils.pretty_size(100) == "100B"
assert utils.pretty_size(1024) == "1kB"
- assert utils.pretty_size(1024 + (1024/2)) == "1.5kB"
+ assert utils.pretty_size(1024 + (1024/2.0)) == "1.5kB"
assert utils.pretty_size(1024*1024) == "1M"