PageRenderTime 22ms CodeModel.GetById 7ms RepoModel.GetById 0ms app.codeStats 0ms

/tests/web/test_client.py

https://bitbucket.org/prologic/circuits/
Python | 29 lines | 17 code | 11 blank | 1 comment | 1 complexity | 300b9b4091f5486712509ae727ebac17 MD5 | raw file
  1. #!/usr/bin/env python
  2. from circuits.web import Controller
  3. from circuits.web.client import Client, request
  4. class Root(Controller):
  5. def index(self):
  6. return "Hello World!"
  7. def test(webapp):
  8. client = Client()
  9. client.start()
  10. client.fire(request("GET", webapp.server.http.base))
  11. while client.response is None:
  12. pass
  13. client.stop()
  14. response = client.response
  15. assert response.status == 200
  16. assert response.reason == "OK"
  17. s = response.read()
  18. assert s == b"Hello World!"