From bda1306749c62ef4f11cfe567ed7d56c8ad94240 Mon Sep 17 00:00:00 2001 From: Michael Merickel <github@m.merickel.org> Date: Mon, 15 Oct 2018 16:56:42 +0200 Subject: [PATCH] Merge pull request #3388 from mmerickel/black --- 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 4ddbc92..a5a9556 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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,15 +116,19 @@ 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): @@ -127,4 +137,3 @@ def copy(self): self.copied = True return self - -- Gitblit v1.9.3