Are there ways to test my error_handlers setup in the app.yaml file, especially the error code over_quota?
error_handlers
dev_appserver.py is the application that is parsing your app.yaml and serving these error files. This means that you're best bet is probably a straight up acceptance test where you bring up dev_appserver.py and try hitting it localhost:8080 with GETs and PUTs that would trigger the various errors you're expecting.
So, if /foo returns a 404, you could do the following with Python requests:
>>> def test_foo():
>>> response = requests.get('/foo')
>>> assert response.status_code == 404
In this specific case it sounds like you're trying to explicitly raise the over_quota error. This link mentions that the exception you're looking for is apiproxy_errors.OverQuotaError.
I'm not sure what your test code is, but have you tried explicitly raising this error, with straight up raise?
I was able to run the following code after bootstrapping my apiproxy_stub_map, setting up my path, etc.:
from google.appengine.runtime import apiproxy_errors
def test_foo():
raise apiproxy_errors.OverQuotaError
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With