diff options
| author | Michael Merickel <michael@merickel.org> | 2018-10-15 01:55:54 -0500 |
|---|---|---|
| committer | Michael Merickel <michael@merickel.org> | 2018-10-15 09:24:07 -0500 |
| commit | 0c29cf2df41600d3906d521c72991c7686018b71 (patch) | |
| tree | ff907f90ec9467e12874c9b2c961549d0e7caf74 /tests/test_wsgi.py | |
| parent | 851c368e3c158e264358de10446f5b5de240e534 (diff) | |
| download | pyramid-0c29cf2df41600d3906d521c72991c7686018b71.tar.gz pyramid-0c29cf2df41600d3906d521c72991c7686018b71.tar.bz2 pyramid-0c29cf2df41600d3906d521c72991c7686018b71.zip | |
format source using black
Diffstat (limited to 'tests/test_wsgi.py')
| -rw-r--r-- | tests/test_wsgi.py | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/tests/test_wsgi.py b/tests/test_wsgi.py index 4ddbc9201..a5a955621 100644 --- a/tests/test_wsgi.py +++ b/tests/test_wsgi.py @@ -1,8 +1,10 @@ import unittest + class WSGIAppTests(unittest.TestCase): def _callFUT(self, app): from pyramid.wsgi import wsgiapp + return wsgiapp(app) def test_wsgiapp_none(self): @@ -23,9 +25,11 @@ class WSGIAppTests(unittest.TestCase): response = decorator(context, request) self.assertEqual(response, app) + class WSGIApp2Tests(unittest.TestCase): def _callFUT(self, app): from pyramid.wsgi import wsgiapp2 + return wsgiapp2(app) def test_wsgiapp2_none(self): @@ -35,8 +39,10 @@ class WSGIApp2Tests(unittest.TestCase): context = DummyContext() request = DummyRequest() request.subpath = ('subpath',) - request.environ = {'SCRIPT_NAME':'/foo', - 'PATH_INFO':'/b/view_name/subpath'} + request.environ = { + 'SCRIPT_NAME': '/foo', + 'PATH_INFO': '/b/view_name/subpath', + } decorator = self._callFUT(dummyapp) response = decorator(context, request) self.assertEqual(response, dummyapp) @@ -47,7 +53,7 @@ class WSGIApp2Tests(unittest.TestCase): context = DummyContext() request = DummyRequest() request.subpath = ('subpath',) - request.environ = {'SCRIPT_NAME':'/foo', 'PATH_INFO':'/b/subpath'} + request.environ = {'SCRIPT_NAME': '/foo', 'PATH_INFO': '/b/subpath'} decorator = self._callFUT(dummyapp) response = decorator(context, request) self.assertEqual(response, dummyapp) @@ -58,7 +64,7 @@ class WSGIApp2Tests(unittest.TestCase): context = DummyContext() request = DummyRequest() request.subpath = () - request.environ = {'SCRIPT_NAME':'/foo', 'PATH_INFO':'/b/view_name'} + request.environ = {'SCRIPT_NAME': '/foo', 'PATH_INFO': '/b/view_name'} decorator = self._callFUT(dummyapp) response = decorator(context, request) self.assertEqual(response, dummyapp) @@ -69,7 +75,7 @@ class WSGIApp2Tests(unittest.TestCase): context = DummyContext() request = DummyRequest() request.subpath = () - request.environ = {'SCRIPT_NAME':'/foo', 'PATH_INFO':'/view_name'} + request.environ = {'SCRIPT_NAME': '/foo', 'PATH_INFO': '/view_name'} decorator = self._callFUT(dummyapp) response = decorator(context, request) self.assertEqual(response, dummyapp) @@ -80,7 +86,7 @@ class WSGIApp2Tests(unittest.TestCase): context = DummyContext() request = DummyRequest() request.subpath = () - request.environ = {'SCRIPT_NAME':'/foo', 'PATH_INFO':'/'} + request.environ = {'SCRIPT_NAME': '/foo', 'PATH_INFO': '/'} decorator = self._callFUT(dummyapp) response = decorator(context, request) self.assertEqual(response, dummyapp) @@ -91,7 +97,7 @@ class WSGIApp2Tests(unittest.TestCase): context = DummyContext() request = DummyRequest() request.subpath = () - request.environ = {'SCRIPT_NAME':'', 'PATH_INFO':'/'} + request.environ = {'SCRIPT_NAME': '', 'PATH_INFO': '/'} decorator = self._callFUT(dummyapp) response = decorator(context, request) self.assertEqual(response, dummyapp) @@ -102,7 +108,7 @@ class WSGIApp2Tests(unittest.TestCase): context = DummyContext() request = DummyRequest() request.subpath = () - request.environ = {'SCRIPT_NAME':'/foo', 'PATH_INFO':'/'} + request.environ = {'SCRIPT_NAME': '/foo', 'PATH_INFO': '/'} app = DummyApp() decorator = self._callFUT(app) response = decorator(context, request) @@ -110,16 +116,20 @@ class WSGIApp2Tests(unittest.TestCase): self.assertEqual(request.environ['PATH_INFO'], '/') self.assertEqual(request.environ['SCRIPT_NAME'], '/foo') + def dummyapp(environ, start_response): """ """ + class DummyApp(object): def __call__(self, environ, start_response): """ """ + class DummyContext: pass + class DummyRequest: def get_response(self, application): return application @@ -127,4 +137,3 @@ class DummyRequest: def copy(self): self.copied = True return self - |
