This context will switch the
(and then resets it to what it was before).
tests/testthat/dir folder doesn't exist,
be run to create mocks.
If it exists,
with_mock_api() will be run.
To re-record mock files, simply delete
tests/testthat/dir and run the test.
with_mock_dir(dir, expr, simplify = TRUE, replace = TRUE)
character string, unique folder name that will be used or created
Code to run inside the context
TRUE (default), plain-text responses with status 200
will be written as just the text of the response body. In all other cases,
httr2_response object will be written out to
a .R file using
dir replace the contents of
(default) or be added in front of the existing paths? The default behavior
here is the opposite of
.mockPaths() so that the tests inside of
with_mock_dir() are fully isolated.
vignette("httptest2") for usage examples.