to enhance massimo's response, you can test the HTTP status code in the
except block:
>>> try:
... index()
... except HTTP, e:
... assert(e.status == 400)
... assert(e.body == "Not permitted")
...
def show():
"""
>>> request.args.clear()
>>> try: print show()
>>> except HTTP, http: print 'ok'
ok
"""
if request.args(0) == None:
redirect(URL('index'))
On Jan 27, 4:08 am, walter wrote:
> Excuse me. May be I'm stupid, but I don't understand how to test next
I have another one question. How to interact with controller in shell?
for example:
def index():
"""
>>> request.vars.update(title='xxx'
>>> assert(len(index()['articles'].find(r:r['title']=='xxx'))==1)
>>> db(db.article.title=='xxx').delete()
1
"""
form = SQLFORM(db.article)
if form.accepts(request.vars): response.flash = "óÔÁÔØÑ
ÄÏÂÁ
4 matches
Mail list logo