【问题标题】:Flask-Reatful unit testing response 404 Not FoundFlask-Restful 单元测试响应 404 Not Found
【发布时间】:2018-06-08 00:58:11
【问题描述】:

我使用 Flask-Reatful 来构建 Flask Restful。但是当我进行单元测试时,我能够得到 hello 响应,并且登录返回了 404 的响应。

我做错了吗?

代码: https://gist.github.com/LuGuoHuas/3578cf0c8681638afb288b5d796760a4

【问题讨论】:

  • 我没有看到通往“/hello”的路线——我错过了什么吗?
  • @fiacre in init.py def create_app
  • 谢谢。在测试setUp方法中,你会打印self.app吗?
  • @fiacre print self.app is and print self.client is >.like this?
  • @fiacre 我在 self.app 中只看到两条规则,/hello 和 /static/

标签: python flask python-3.6 flask-restful


【解决方案1】:

因为create_app后没有构建Flask-Restful,所以没有加载路由。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-01-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-15
    • 2016-05-05
    • 2019-06-09
    相关资源
    最近更新 更多