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)
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))