-
Notifications
You must be signed in to change notification settings - Fork 26
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
Introduce httptest for API mocking; update to testthat 3e #223
Conversation
Integration test failures say the license has expired: https://github.com/rstudio/connectapi/actions/runs/8571214328/job/23490961358?pr=223#step:7:28 @colearendt @aronatkins can we fix this? |
I do not have sufficient rights. It'll have to be @colearendt. |
54617f9
to
fea06d9
Compare
Integration tests are running now that this is rebased on main, but now they're failing, I'm guessing it has to do with testthat 3e. I'll fix. |
b691659
to
22ab78a
Compare
…fix bug in error message
…to remove this This reverts commit b691659.
9ebcf72
to
b1c4dcb
Compare
This PR adds https://enpiar.com/r/httptest/ for testing the API client with mock/recorded API responses. This allows contributors to run tests for the R code without having to run a local Connect server, which is not an option for most. I'd like to get some good overall coverage of the package's behaviors before doing any refactoring, just so we have some confidence that we aren't breaking things.
Before this PR, the line coverage of the non-integration tests was 15%. I've added some basic tests for Content, Permissions, and Users, pulling in the fixtures from posit-sdk-py. This gets coverage up to 24%. Followup PRs can extend this approach to get more coverage.
I avoided making changes in the package itself, though I did fix a bug in an error message builder, one broken API doc link, and I added
Config/testthat/edition: 3
to the DESCRIPTION, both of which triggered some autoformatting.I also removed the
mockery
dependency, as it was only being used in one test that could be rewritten to use a mock request.