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 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 * 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), framework and requires [pathod](http://pathod.org) and [flask](http://flask.pocoo.org/).
[pathod](http://pathod.org) and [flask](http://flask.pocoo.org/).
* Rendering the documentation requires [countershape](http://github.com/cortesi/countershape). * Rendering the documentation requires [countershape](http://github.com/cortesi/countershape).

View File

@ -1,6 +1,5 @@
import threading, Queue import threading, Queue
import flask import flask
import human_curl as hurl
import libpathod.test, libpathod.pathoc import libpathod.test, libpathod.pathoc
from libmproxy import proxy, flow, controller from libmproxy import proxy, flow, controller
import tutils import tutils
@ -205,14 +204,23 @@ class ReverseProxTest(ProxTestBase):
) )
return d 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( p = libpathod.pathoc.Pathoc("localhost", self.proxy.port, ssl=self.ssl, sni=sni)
"http://127.0.0.1:%s"%self.proxy.port + "/p/" + spec, p.connect()
validate_cert=False, return p
#debug=hurl.utils.stdout_debug
) def pathod(self, spec, sni=None):
return r """
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)