httpexpect
httpexpect copied to clipboard
Add unit tests for redirect and retry support
Redirect methods (WithRedirectPolicy, WithMaxRedirects) and retry methods (WithRetryPolicy, WithMaxRetries, WithRetryDelay) are already covered with end-to-end tests (e2e_redirect_test.go, e2e_retry_test.go), but unit tests are missing.
It would be nice to add unit tests for these methods to request_test.go. Those unit tests use mockClient to inspect generated http.Requests.
@gavv could I make a PR to add these tests?
@gopalanvinay Sure, you're welcome.
Is this issue still open?
@123vivekr Hi! Yes, there is unmerged PR with unresolved issues, see #94. Feel free to pick up the task.
Thank you! I'm a beginner in Golang. I'll give this a try and submit a PR for review soon.
Hi @gavv is it still open? If so, I would like to pick it up. Although, looks like #94 is ready to be merged already.
@kaustubhmallik Feel free to take it up. I'm not working on it
Hi, the issue is still open. See also discussion in #94.
@gavv hi, for testing the WithRetryDelay
wdyt if we do time.Sleep
in the unit test? then assert if the total sleep time is as expected
or you might have concerns about this?
my concern is that by doing sleep, the unit test will be slower by some miliseconds (approximately, because we sleep)
I think short sleeps, maybe below 10-20 ms per test, are OK.
got it, will keep the sleep around that
Landed