aboutsummaryrefslogtreecommitdiffstats
path: root/pathod
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2012-06-07 11:23:23 +1200
committerAldo Cortesi <aldo@nullcube.com>2012-06-07 11:23:23 +1200
commit14b2a69d2119d8b9d0260aa31190fc7869b45e05 (patch)
treec60d2ccfe7ca32a73b4c3847bff937ba89c1c001 /pathod
parentb5a74a26ee6548b493cdece5a05f4fcba71c0012 (diff)
downloadmitmproxy-14b2a69d2119d8b9d0260aa31190fc7869b45e05.tar.gz
mitmproxy-14b2a69d2119d8b9d0260aa31190fc7869b45e05.tar.bz2
mitmproxy-14b2a69d2119d8b9d0260aa31190fc7869b45e05.zip
Start building a Pathod unit testing truss.
- Add test.py, which will house the testing API. - Extend API with a shutdown method, used to terminate the test daemon. - Refactor to allow clean shutdown.
Diffstat (limited to 'pathod')
-rwxr-xr-xpathod19
1 files changed, 7 insertions, 12 deletions
diff --git a/pathod b/pathod
index 6245fc41..946da92d 100755
--- a/pathod
+++ b/pathod
@@ -31,16 +31,11 @@ if __name__ == "__main__":
help='SSL cert file. If not specified, a default cert is used.'
)
args = parser.parse_args()
- settings = dict(
- staticdir=args.staticdir
- )
- application = pathod.PathodApp(**settings)
- for i in args.anchors:
- try:
- rex, spec = utils.parse_anchor_spec(i, settings)
- except utils.AnchorError, v:
- parser.error(str(v))
- application.add_anchor(rex, spec)
+
+ try:
+ app = pathod.make_app(staticdir=args.staticdir, anchors=args.anchors)
+ except utils.AnchorError, v:
+ parser.error(str(v))
if args.ssl:
ssl = dict(
@@ -50,8 +45,8 @@ if __name__ == "__main__":
else:
ssl = None
try:
- port = pathod.make_server(application, args.port, args.address, ssl)
+ server, port = pathod.make_server(app, args.port, args.address, ssl)
print "%s listening on port %s"%(version.NAMEVERSION, port)
- pathod.run()
+ pathod.run(server)
except KeyboardInterrupt:
pass