wsgi_test.py 657 B

1234567891011121314151617181920
  1. from wsgiref.validate import validator
  2. from tornado.testing import AsyncHTTPTestCase
  3. from tornado.wsgi import WSGIContainer
  4. class WSGIContainerTest(AsyncHTTPTestCase):
  5. # TODO: Now that WSGIAdapter is gone, this is a pretty weak test.
  6. def wsgi_app(self, environ, start_response):
  7. status = "200 OK"
  8. response_headers = [("Content-Type", "text/plain")]
  9. start_response(status, response_headers)
  10. return [b"Hello world!"]
  11. def get_app(self):
  12. return WSGIContainer(validator(self.wsgi_app))
  13. def test_simple(self):
  14. response = self.fetch("/")
  15. self.assertEqual(response.body, b"Hello world!")