我在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
参数?
答案 0 :(得分:2)
response = self.app.get(url(controller ='search',action ='index'), params = {'q':'我的查询'})