【发布时间】:2015-11-25 05:25:44
【问题描述】:
我在测试 API 时遇到了以下错误。
AppError: Bad response: 404 Not Found (not 200 OK or 3xx redirect for http://localhost/_ah/spi/AdminAuthentication.authenticate)
'{"state": "APPLICATION_ERROR", "error_message": "No user with the E-mail address \\"foo@bar.com\\" exists."}'
这里是测试函数,我写的
def test_should_not_authenticate_if_there_is_no_user_for_email(self):
app = endpoints.api_server([AdminAuthentication], restricted=False)
testapp = webtest.TestApp(app)
msg = {'email': 'foo@bar.com'}
resp = testapp.post_json('/_ah/spi/AdminAuthentication.authenticate', msg)
self.assertEqual(resp.status_int, 404)
app.yaml文件对应的路由定义应该是这样的,
- url: /_ah/spi/.*
script: api.services.application
【问题讨论】:
标签: google-app-engine nosetests webtest