-
Notifications
You must be signed in to change notification settings - Fork 5
refactor(epidatacall): remove fetch_csv
and use testthat
mocking
#115
New issue
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
Conversation
* use testthat::with_mocked_bindings for test mocking * delete fetch_csv
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Have some non-blocking discussion and suggested related/nearby cleanup.
Co-authored-by: brookslogan <[email protected]>
tests/testthat/test-epidatacall.R
Outdated
csv_out <- epidata_call %>% fetch_csv() | ||
expect_identical(tbl_out, csv_out) | ||
# This test compares the output of a tibble using fetch and fetch_tbl. | ||
with_mocked_bindings( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I run this locally with no internet connection, its hanging. This makes me think content isn't being mocked and the test is just calling the server.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for pointing this out. the problem was that I was mocking httr::content, which parse the response, but i didnt mock epidatr::request_impl, which was still making a request (even though the request wasn't being used).
Fixes #110 and addresses this comment.