<s> import wsgi_intercept . webtest_intercept <EOL> from applications . sahana . modules . s3_test import WSGI_Test <EOL> class CR_Test ( WSGI_Test ) : <EOL> """<STR_LIT>""" <EOL> module = '<STR_LIT>' <EOL> def __init__ ( self , db ) : <EOL> WSGI_Test . __init__ ( self , db ) <EOL> return <EOL> def setUp ( self , db ) : <EOL> """<STR_LIT>""" <EOL> wsgi_intercept . add_wsgi_intercept ( self . HOST , self . PORT , create_fn ) <EOL> return <EOL> def runTest ( self , db ) : <EOL> "<STR_LIT>" <EOL> self . runTestLogin ( ) <EOL> self . runTestShelter ( ) <EOL> return <EOL> def runTestLogin ( self ) : <EOL> if '<STR_LIT>' in test . getPage ( '<STR_LIT>' % module ) : <EOL> test . assertHeader ( "<STR_LIT:Content-Type>" , "<STR_LIT>" ) <EOL> test . assertInBody ( '<STR_LIT>' ) <EOL> return <EOL> def runTestShelter ( self ) : <EOL> resource = '<STR_LIT>' <EOL> if '<STR_LIT>' in test . getPage ( '<STR_LIT>' % ( module , resource ) ) : <EOL> test . assertHeader ( "<STR_LIT:Content-Type>" , "<STR_LIT>" ) <EOL> test . assertInBody ( '<STR_LIT>' ) <EOL> if '<STR_LIT>' in test . getPage ( '<STR_LIT>' % ( module , resource ) ) : <EOL> test . assertHeader ( "<STR_LIT:Content-Type>" , "<STR_LIT>" ) <EOL> test . assertInBody ( '<STR_LIT:[>' ) <EOL> if '<STR_LIT>' in test . getPage ( '<STR_LIT>' % ( module , resource ) ) : <EOL> test . assertHeader ( "<STR_LIT:Content-Type>" , "<STR_LIT>" ) <EOL> return <EOL> def setUpShelter ( self , db ) : <EOL> "<STR_LIT>" <EOL> resource = '<STR_LIT>' <EOL> table = module + '<STR_LIT:_>' + resource <EOL> if not len ( db ( ) . select ( db [ table ] . ALL ) ) : <EOL> db [ table ] . insert ( <EOL> name = "<STR_LIT>" , <EOL> description = "<STR_LIT>" , <EOL> location_id = <NUM_LIT:1> , <EOL> person_id = <NUM_LIT:1> , <EOL> address = '<STR_LIT>' , <EOL> capacity = <NUM_LIT:100> , <EOL> dwellings = <NUM_LIT:10> , <EOL> persons_per_dwelling = <NUM_LIT:10> , <EOL> area = '<STR_LIT>' <EOL> ) <EOL> return <EOL> def test_cr ( db ) : <EOL> test = CR_Test ( db ) <EOL> test . setUp ( db ) <EOL> test . runTest ( db ) <EOL> return <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> test_cr ( db ) </s>
