You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My function my_perform() uses httr2::req_perform_iterative() which has a max_reqs argument (default to 20). I'd like to test that my_perform() performs an infinite or very large number of iterative requests.
For now I am testing the argument:
test_that("my_perform() performs Inf requests by default", {
expect_equal(formals(my_perform)$max_reqs, Inf)
})
Is this ideal or is it instead better to mock a large request? I created a fake response with data removed which allows for
I don't think you want to test that it actually makes an infinite number of requests. I would do what I gather you're doing with the fake responses, and test that your function does the iteration as expected, and you get the right results that would only get if it correctly paged through the API as you expect.
(And I don't understand why the above requires 2 mock files, endpoint.R and endpoint-6fdf2d.R.)
I can't say without seeing your code, but my guess is that the iterative next_req function you have is adding a query parameter to fetch the next page of results or whatever, and 6fdf2d is the hash of that added query string.
This is more for a discussion, and is a copy of an issue I thought might belong in httr2.
My function
my_perform()
useshttr2::req_perform_iterative()
which has amax_reqs
argument (default to 20). I'd like to test thatmy_perform()
performs an infinite or very large number of iterative requests.For now I am testing the argument:
Is this ideal or is it instead better to mock a large request? I created a fake response with data removed which allows for
(And I don't understand why the above requires 2 mock files,
endpoint.R
andendpoint-6fdf2d.R
.)The text was updated successfully, but these errors were encountered: