I'm looking for a way to be able to reproduce a Hackney HTTP POST request timeout in one of my controller tests. I'm also using ExVCR, but that doesn't seem to allow you to force a request timeout either.
I've tried setting the Hackney timeout to 1 when I make the request, and it times out, but I don't want to actually make the request in my test.
I'd be open to using a mock/stub, but want to make sure I can still use ExVCR in the unit tests that are actually making requests to the service I'm integrating with. All the mock libraries and patterns I've seen stub out the entire module for the entire test environment which is not what I want.
Here's a sample of the request I'm making:
:hackney.post(url, [timeout: 1], body, get_auth())
and I would like this to return {:error, :timeout}
which is what Hackney returns in a real timeout scenario.