<s> from circuits . web import Controller <EOL> from circuits . web . client import Client , request <EOL> class Root ( Controller ) : <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> super ( Root , self ) . __init__ ( * args , ** kwargs ) <EOL> self += Leaf ( ) <EOL> def index ( self ) : <EOL> return "<STR_LIT>" <EOL> def name ( self ) : <EOL> return "<STR_LIT>" <EOL> class Leaf ( Controller ) : <EOL> channel = "<STR_LIT>" <EOL> def index ( self ) : <EOL> return "<STR_LIT>" <EOL> def city ( self ) : <EOL> return "<STR_LIT>" <EOL> def make_request ( webapp , path ) : <EOL> client = Client ( ) <EOL> client . start ( ) <EOL> client . fire ( request ( "<STR_LIT:GET>" , path ) ) <EOL> while client . response is None : <EOL> pass <EOL> client . stop ( ) <EOL> response = client . response <EOL> s = response . read ( ) <EOL> return response . status , s <EOL> def test_root ( webapp ) : <EOL> status , content = make_request ( webapp , webapp . server . http . base ) <EOL> assert status == <NUM_LIT:200> <EOL> assert content == b"<STR_LIT>" <EOL> def test_root_name ( webapp ) : <EOL> status , content = make_request ( webapp , "<STR_LIT>" % webapp . server . http . base ) <EOL> assert status == <NUM_LIT:200> <EOL> assert content == b"<STR_LIT>" <EOL> def test_leaf ( webapp ) : <EOL> status , content = make_request ( <EOL> webapp , "<STR_LIT>" % webapp . server . http . base ) <EOL> assert status == <NUM_LIT:200> <EOL> assert content == b"<STR_LIT>" <EOL> def test_city ( webapp ) : <EOL> status , content = make_request ( <EOL> webapp , "<STR_LIT>" % webapp . server . http . base ) <EOL> assert status == <NUM_LIT:200> <EOL> assert content == b"<STR_LIT>" </s>
