PageRenderTime 45ms CodeModel.GetById 39ms app.highlight 3ms RepoModel.GetById 2ms 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
 3from circuits.web import Controller
 4
 5from circuits.web.client import Client, request
 6
 7
 8class Root(Controller):
 9
10    def index(self):
11        return "Hello World!"
12
13
14def test(webapp):
15    client = Client()
16    client.start()
17
18    client.fire(request("GET", webapp.server.http.base))
19    while client.response is None:
20        pass
21
22    client.stop()
23
24    response = client.response
25    assert response.status == 200
26    assert response.reason == "OK"
27
28    s = response.read()
29    assert s == b"Hello World!"