'This tests optional middleware we have which dumps
the requests to stdout.'

def test_debug(self):

    self.output = StringIO()
    self.useFixture(fixtures.MonkeyPatch('sys.stdout', self.output))
    class Application(wsgi.Application, ):
        'Dummy    application    to    test    debug.'
        def __call__(self, environ, start_response):
            start_response('200', [('X-Test', 'checking')])
            return ['Test    result']
    application = wsgi.Debug(Application())
    result = webob.Request.blank('/').get_response(application)
    self.assertEqual(result.body, 'Test    result')
    self.assertIn('****************************************    REQUEST    ENVIRON', self.output.getvalue())
