tests/testthat/helper-vcr.R

library(vcr)

# make path relative to test directory
cassette_dir <- function(x) {
  file.path(rprojroot::find_testthat_root_file(), "cassettes", x)
}

vcr::vcr_configure(
  # set to 'once' when recording new requests
  record = "once",
  match_requests_on = c("method", "uri", "body"),
  filter_sensitive_data = list("<totallyrealpat>" = Sys.getenv("OSF_PAT")),
  log = nzchar(Sys.getenv("VCR_LOG")),
  log_opts = list(
    file = Sys.getenv("VCR_LOG"),
    log_prefix = "Cassette",
    date = TRUE
  )
)

Try the osfr package in your browser

Any scripts or data that you put into this service are public.

osfr documentation built on Sept. 26, 2022, 1:06 a.m.