diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2012-06-19 14:23:22 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2012-06-19 14:23:22 +1200 |
commit | ce1ef554561d55a414961993dcaf8f11000d1f22 (patch) | |
tree | 150d207891eb3ad877a12fea170618af545bb70c /test/test_wsgi.py | |
parent | c7e9051cbbee1e76abb24518268d30a24df3a16a (diff) | |
download | mitmproxy-ce1ef554561d55a414961993dcaf8f11000d1f22.tar.gz mitmproxy-ce1ef554561d55a414961993dcaf8f11000d1f22.tar.bz2 mitmproxy-ce1ef554561d55a414961993dcaf8f11000d1f22.zip |
Adapt WSGI, convert test suite to nose.
Diffstat (limited to 'test/test_wsgi.py')
-rw-r--r-- | test/test_wsgi.py | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/test/test_wsgi.py b/test/test_wsgi.py index c55ab1d8..7763b9e5 100644 --- a/test/test_wsgi.py +++ b/test/test_wsgi.py @@ -1,7 +1,13 @@ import cStringIO, sys import libpry -from netlib import wsgi -import tutils +from netlib import wsgi, odict + + +def treq(): + cc = wsgi.ClientConn(("127.0.0.1", 8888)) + h = odict.ODictCaseless() + h["test"] = ["value"] + return wsgi.Request(cc, "http", "GET", "/", h, "") class TestApp: @@ -16,10 +22,10 @@ class TestApp: return ['Hello', ' world!\n'] -class uWSGIAdaptor(libpry.AutoTree): +class TestWSGI: def test_make_environ(self): - w = wsgi.WSGIAdaptor(None, "foo", 80) - tr = tutils.treq() + w = wsgi.WSGIAdaptor(None, "foo", 80, "version") + tr = treq() assert w.make_environ(tr, None) tr.path = "/foo?bar=voing" @@ -28,8 +34,8 @@ class uWSGIAdaptor(libpry.AutoTree): def test_serve(self): ta = TestApp() - w = wsgi.WSGIAdaptor(ta, "foo", 80) - r = tutils.treq() + w = wsgi.WSGIAdaptor(ta, "foo", 80, "version") + r = treq() r.host = "foo" r.port = 80 @@ -43,8 +49,8 @@ class uWSGIAdaptor(libpry.AutoTree): assert "Server:" in val def _serve(self, app): - w = wsgi.WSGIAdaptor(app, "foo", 80) - r = tutils.treq() + w = wsgi.WSGIAdaptor(app, "foo", 80, "version") + r = treq() r.host = "foo" r.port = 80 wfile = cStringIO.StringIO() |