aboutsummaryrefslogtreecommitdiffstats
path: root/libpathod/test.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2012-07-25 10:34:57 +1200
committerAldo Cortesi <aldo@nullcube.com>2012-07-25 10:34:57 +1200
commit8cfbc2f80eb186e0958b7fbf7b9f70dca37389f7 (patch)
treec18289e1f5ac0f8d1c9ec958fbe82e24a4b7eff7 /libpathod/test.py
parente1df7f47a670e5f2f3cfb27d77efecec1157333e (diff)
downloadmitmproxy-8cfbc2f80eb186e0958b7fbf7b9f70dca37389f7.tar.gz
mitmproxy-8cfbc2f80eb186e0958b7fbf7b9f70dca37389f7.tar.bz2
mitmproxy-8cfbc2f80eb186e0958b7fbf7b9f70dca37389f7.zip
Refactor test.py, add unit tests for app.py corner case.
Diffstat (limited to 'libpathod/test.py')
-rw-r--r--libpathod/test.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/libpathod/test.py b/libpathod/test.py
index e8ca536a..5bcebcb6 100644
--- a/libpathod/test.py
+++ b/libpathod/test.py
@@ -5,9 +5,9 @@ import pathod, utils
IFACE = "127.0.0.1"
class Daemon:
- def __init__(self, staticdir=None, anchors=(), ssl=None, sizelimit=None, noweb=False):
+ def __init__(self, ssl=None, **daemonargs):
self.q = Queue.Queue()
- self.thread = PaThread(self.q, staticdir, anchors, ssl, sizelimit, noweb)
+ self.thread = PaThread(self.q, ssl, daemonargs)
self.thread.start()
self.port = self.q.get(True, 5)
self.urlbase = "%s://%s:%s"%("https" if ssl else "http", IFACE, self.port)
@@ -42,10 +42,10 @@ class Daemon:
class PaThread(threading.Thread):
- def __init__(self, q, staticdir, anchors, ssl, sizelimit, noweb):
+ def __init__(self, q, ssl, daemonargs):
threading.Thread.__init__(self)
- self.q, self.staticdir, self.anchors, self.ssl, self.sizelimit = q, staticdir, anchors, ssl, sizelimit
- self.noweb = noweb
+ self.q, self.ssl = q, ssl
+ self.daemonargs = daemonargs
def run(self):
if self.ssl is True:
@@ -58,10 +58,7 @@ class PaThread(threading.Thread):
self.server = pathod.Pathod(
(IFACE, 0),
ssloptions = ssloptions,
- anchors = self.anchors,
- staticdir = self.staticdir,
- sizelimit = self.sizelimit,
- noweb = self.noweb
+ **self.daemonargs
)
self.q.put(self.server.port)
self.server.serve_forever()