how to unittest the template variables passed to jinja2 template from webapp2 request handler

后端 未结 2 582
醉梦人生
醉梦人生 2021-01-02 05:29

I\'m trying to test my webapp2 handlers. To do this, I thought it would be a good idea to send a request to the handler e.g.:

request = webapp2.Request.blank(         


        
2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-02 05:55

    You can mock BaseHandler.render_template method and test its parameters.

    See this question for a list of popular Python mocking frameworks.

提交回复
热议问题