开发者

Pylons: how can I supply a GET parameter in a URL controller call?

I've got a functional test running in Pylons. It calls a page as follows:

    response = self.app.get(url(controller='search', action='index'))
    开发者_运维问答assert not 'hello' in response

This is looking at /search, but I'd like to know how to look for /search?q=hello. The controller looks for a GET parameter called q in the url, as follows:

class SearchController(BaseController):
    def index(self):
        c.q = request.params.get('q', None)

How can I supply a q parameter in the self.app.get call?


response = self.app.get(url(controller='search',action='index'), params={'q':'My query'})

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜