开发者

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

开发者 https://www.devze.com 2023-01-25 18:27 出处:网络
I\'ve got a functional test running in Pylons. It calls a page as follows: response = self.app.get(url(controller=\'search\', action=\'index\'))

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

精彩评论

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