We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there a way to emulate the server being down and then coming up in the middle of a test? The code that I am testing does something like
def get_data(): result = requests.post(...) while is_error(result): sleep(5) result = requests.post(...) return result.json()
I would like to write a test that does something like
httpretty.register(httpretty.POST, 'http://example.com/request', body='{"foo": "bar"}, ready_after_milliseconds=500) result = get_data()
Ideally, I could check that httpretty rejected one request and then satisfied a second.
I can't register the url after the failed call, because control won't return to the test driver.
The text was updated successfully, but these errors were encountered:
It appears that one way to emulate this is
raise MaxRetryError("Mock server not ready yet", url=uri)
inside the callback function to generate the body. You can also increment a variable there to know how many tries have been attempted.
Sorry, something went wrong.
No branches or pull requests
Is there a way to emulate the server being down and then coming up in the middle of a test? The code that I am testing does something like
I would like to write a test that does something like
Ideally, I could check that httpretty rejected one request and then satisfied a second.
I can't register the url after the failed call, because control won't return to the test driver.
The text was updated successfully, but these errors were encountered: