httptest
httptest copied to clipboard
A Test Environment for HTTP Requests in R
i have a test where i use httptest like this test_that("check list parameter", { httptest::with_mock_api({ expect_error(testClient$getMatrixData(c(10)), regexp = "listOfMatrixNames needs to be a vector of strings") expect_error(testClient$getMatrixData(10), regexp = "listOfMatrixNames...
If a test sets a temporary directory like so https://github.com/maelle/setwdsetwd/blob/main/tests/testthat/test-request.R then no mock directory is set in the actual package. If I comment out the line with `withr::local_dir(tempdir)` then a...
Just a note for info (should httptest get discussions?) I had a case with tests passing on Ubuntu and failing on macOS and Windows. I first thought the mock file...
Hello, I am hoping that in a future release you can reduce the length of the filepaths/filenames that are generated for storing the response data. Currently, you are including the...
Thanks a lot for your great work on this package. I'm using httptest in the vignette for a package that interacts with an API. The API credentials are stored in...
I was thinking about this whilst looking at rtweet docs and seeing that the twitteR repo is archived.
e.g. when the API returns 502, 502, 200. Suggestion: making httptest able to loop through mockfile if they are named * filename-corresponding-to-the-request-1 * filename-corresponding-to-the-request-2 * filename-corresponding-to-the-request-3 * ...
Writing down what I think I understood * [Your blog post](https://enpiar.com/2017/06/21/7-hard-testing-problems-made-easy-by-httptest/#5-rare-or-difficult-to-trigger-server-behavior). How exactly did you create https://github.com/Crunch-io/rcrunch/blob/d1b5cade5e7b0608ddc1ce5de1a576e2d3614d84/tests/testthat/app.crunch.io/503.R? I.e. what did you have to guess? * Use `capture_requests(, simplify = FALSE)`...
Perhaps an Rd macro, or some roxygen magic, to do some setup/teardown in `\dontshow` blocks. References: * https://stat.ethz.ch/R-manual/R-devel/library/tools/html/loadRdMacros.html * https://developer.r-project.org/parseRd.pdf
I have a function that requests some data from an API using this piece of code: ``` df %>% mutate(new_column = future_map(id, function(x) { GET(create_request(x), authenticate(username, password, type = "basic"))...