I have faced the below error while testing an 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."}'
Here is the test function, I wrote
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)
corresponding routing definition of app.yaml
file should look like,
- url: /_ah/spi/.*
script: api.services.application