示例#1
0
    def test_call_with_response(self):
        middleware = wsgi.Middleware(None)
        middleware.process_request = mock.Mock(return_value=mock.sentinel.resp)

        resp = middleware(mock.sentinel.req)

        self.assertEqual(mock.sentinel.resp, resp)
        middleware.process_request.assert_called_once_with(mock.sentinel.req)
示例#2
0
 def test_middleware_call(self):
     self.middleware = wsgi.Middleware(None)
     mock_request = mock.Mock()
     mock_request.get_response.return_value = "a response"
     self.assertEqual("a response", self.middleware(mock_request))