diff options
| author | Chris McDonough <chrism@agendaless.com> | 2008-07-19 23:45:57 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2008-07-19 23:45:57 +0000 |
| commit | 95b14bdd6c911c584d81a33e5ef42a5d67efdfe8 (patch) | |
| tree | df4cab465f8eaffa409e4df6c365be0ce2ff0bfa /repoze/bfg/tests | |
| parent | ab8048ab0ec363f552320280743323b1fd21ae3f (diff) | |
| download | pyramid-95b14bdd6c911c584d81a33e5ef42a5d67efdfe8.tar.gz pyramid-95b14bdd6c911c584d81a33e5ef42a5d67efdfe8.tar.bz2 pyramid-95b14bdd6c911c584d81a33e5ef42a5d67efdfe8.zip | |
Add wsgiapp decorator.
Diffstat (limited to 'repoze/bfg/tests')
| -rw-r--r-- | repoze/bfg/tests/test_wsgi.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/repoze/bfg/tests/test_wsgi.py b/repoze/bfg/tests/test_wsgi.py new file mode 100644 index 000000000..d905350d6 --- /dev/null +++ b/repoze/bfg/tests/test_wsgi.py @@ -0,0 +1,33 @@ +import unittest + +class WSGIAppTests(unittest.TestCase): + def test_decorator(self): + body = 'Unauthorized' + headerlist = [ ('Content-Type', 'text/plain'), + ('Content-Length', len(body)) ] + status = '401 Unauthorized' + def real_wsgiapp(environ, start_response): + start_response(status, headerlist) + return [body] + from repoze.bfg.wsgi import wsgiapp + wrapped = wsgiapp(real_wsgiapp) + context = DummyContext() + request = DummyRequest({}) + response = wrapped(context, request) + self.assertEqual(response.status, status) + self.assertEqual(response.headerlist, headerlist) + self.assertEqual(response.app_iter, [body]) + +class DummyContext: + pass + +class DummyRequest: + def __init__(self, environ): + self.environ = environ + + + + + + + |
