2010-11-19 31 views
1

J'ai un test fonctionnel fonctionnant en pylônes. Il appelle une page comme suit:Pylônes: comment puis-je fournir un paramètre GET dans un appel de contrôleur d'URL?

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

Cette recherche à /search, mais je voudrais savoir comment chercher /search?q=hello. Le contrôleur recherche un paramètre GET appelé q dans l'URL, comme suit:

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

Comment puis-je fournir un paramètre q dans l'appel self.app.get?

Répondre

2

réponse = self.app.get (url (contrôleur = 'recherche', 'index' = action), params = { 'q': 'Ma requête'})