/tests/web/test_wsgi_application_generator.py

https://bitbucket.org/prologic/circuits/ · Python · 23 lines · 14 code · 8 blank · 1 comment · 0 complexity · c3d7cbf0c5bcee41463d19675e30ae6c MD5 · raw file

  1. #!/usr/bin/env python
  2. from circuits.web import Controller
  3. from circuits.web.wsgi import Application
  4. from .helpers import urlopen
  5. class Root(Controller):
  6. def index(self):
  7. def response():
  8. yield "Hello "
  9. yield "World!"
  10. return response()
  11. application = Application() + Root()
  12. def test(webapp):
  13. f = urlopen(webapp.server.http.base)
  14. s = f.read()
  15. assert s == b"Hello World!"