Pylons:如何在URL控制器调用中提供GET参数?

时间:2010-11-19 12:52:00

标签: pylons

我在Pylons中运行了一个功能测试。它调用页面如下:

    response = self.app.get(url(controller='search', action='index'))
    assert not 'hello' in response

这是关注/search,但我想知道如何寻找/search?q=hello。控制器在url中查找名为q的GET参数,如下所示:

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

如何在self.app.get调用中提供q参数?

1 个答案:

答案 0 :(得分:2)

response = self.app.get(url(controller ='search',action ='index'),                                 params = {'q':'我的查询'})