From 09c73019c562eeb9dd4297b481c11d8078c888ff Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sat, 2 Mar 2013 15:09:22 +1300 Subject: [PATCH] Remove human_curl requirement for the test suite - it's pathoc all the way, baby. --- README.mkd | 3 +-- test/tservers.py | 26 +++++++++++++++++--------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/README.mkd b/README.mkd index 4179ce2be..6d95b86d8 100644 --- a/README.mkd +++ b/README.mkd @@ -67,7 +67,6 @@ Hacking The following components are needed if you plan to hack on mitmproxy: * The test suite uses the [nose](http://readthedocs.org/docs/nose/en/latest/) unit testing - framework and requires [human_curl](https://github.com/Lispython/human_curl), - [pathod](http://pathod.org) and [flask](http://flask.pocoo.org/). + framework and requires [pathod](http://pathod.org) and [flask](http://flask.pocoo.org/). * Rendering the documentation requires [countershape](http://github.com/cortesi/countershape). diff --git a/test/tservers.py b/test/tservers.py index 126923696..d405e745c 100644 --- a/test/tservers.py +++ b/test/tservers.py @@ -1,6 +1,5 @@ import threading, Queue import flask -import human_curl as hurl import libpathod.test, libpathod.pathoc from libmproxy import proxy, flow, controller import tutils @@ -205,14 +204,23 @@ class ReverseProxTest(ProxTestBase): ) return d - def pathod(self, spec): + def pathoc(self, sni=None): """ - Constructs a pathod request, with the appropriate base and proxy. + Returns a connected Pathoc instance. """ - r = hurl.get( - "http://127.0.0.1:%s"%self.proxy.port + "/p/" + spec, - validate_cert=False, - #debug=hurl.utils.stdout_debug - ) - return r + p = libpathod.pathoc.Pathoc("localhost", self.proxy.port, ssl=self.ssl, sni=sni) + p.connect() + return p + + def pathod(self, spec, sni=None): + """ + Constructs a pathod GET request, with the appropriate base and proxy. + """ + if self.ssl: + p = self.pathoc(sni=sni) + q = "get:'/p/%s'"%spec + else: + p = self.pathoc() + q = "get:'/p/%s'"%spec + return p.request(q)