Skip to content

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

Merged
merged 5 commits into from
May 31, 2023

Conversation

dshemetov
Copy link
Contributor

Fixes #110 and addresses this comment.

dshemetov added 2 commits May 26, 2023 11:41
* use testthat::with_mocked_bindings for test mocking
* delete fetch_csv
Copy link
Contributor

@brookslogan brookslogan left a 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.

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(
Copy link
Contributor

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.

Copy link
Contributor Author

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).

@dshemetov dshemetov merged commit c0f3b80 into dev May 31, 2023
@dshemetov dshemetov deleted the ds/testthat branch May 31, 2023 01:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Investigate testthat::{with,local}_mocked_bindings
3 participants