Remove human_curl requirement for the test suite - it's pathoc all the way, baby.

This commit is contained in:
Aldo Cortesi 2013-03-02 15:09:22 +13:00
parent a95d78438c
commit 09c73019c5
2 changed files with 18 additions and 11 deletions

View File

@ -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).

View File

@ -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)