Have you confirmed that "CHOPARD" is in the HTML delivered by the server? Note, the webclient will not run any Javascript or Ajax requests, so if "CHOPARD" is added to the DOM via Javascript after the initial HTML is sent from the server, you won't be able to test for it.
Anthony On Saturday, July 12, 2014 8:04:58 AM UTC-4, 黄祥 wrote: > > hi, > > pardon me for opening the old discussion. i had controllers (master.py) > that contain grid function (brand), and want to test it in command prompt > (functional test), yet in the web browser it show the value (running well > as expected), but not in the terminal. any idea what's going on the > background process of functional test? > *command prompt* > C:\web2py\applications\store\modules>python store_functional_test.py > No handlers could be found for logger "web2py" > 1 > 2 > Changed session ID store > 3 > 4 > 5 > Changed session ID store > 6 > Changed session ID store > 7 > 8 > 9 > Traceback (most recent call last): > File "store_functional_test.py", line 58, in <module> > assert('CHOPARD' in master.text) > AssertionError > > *modules/store_functional_test.py* > #!/usr/bin/env python > # coding: utf8 > > import sys; sys.path.append('../../../') > > from gluon.contrib.webclient import WebClient > > default = WebClient('http://127.0.0.1:8000/store/default/', > postbacks = True) > > print '1' > > default.get('index') > > print '2' > > # login > data = dict(username = 'admin', > password = 'password', > _formname = 'login') > default.post('user/login', data = data) > > print '3' > > # check registration and login were successful > default.get('index') > > print '4' > > assert('Admin' in default.text) > > print '5' > > # logout > default.get('user/logout') > > print '6' > > # login again > data = dict(username = 'admin', > password = 'password', > _formname = 'login') > default.post('user/login', data = data) > > print '7' > > master = WebClient('http://127.0.0.1:8000/store/master/', > postbacks = True) > > master.get('index') > > print '8' > > master.get('brand') > > print '9' > > assert('CHOPARD' in master.text) > > thanks and best regards, > stifan > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.