library("vcr") vcr_dir <- vcr::vcr_test_path("fixtures") # set_base_url("http://localhost:8000") # nolint uncomment when generating vcr cassettes to point test cases to local DB if (!nzchar(Sys.getenv("OPENAQ_API_KEY"))) { if (dir.exists(vcr_dir)) { Sys.setenv("OPENAQ_API_KEY" = "test-api-key-0123456789-0123456789-0123456789-0123456789-0123456") } else { # If there's no mock files nor API token, impossible to run tests stop("No API key nor cassettes, tests cannot be run.", call. = FALSE ) } } invisible(vcr::vcr_configure( dir = vcr_dir, filter_sensitive_data = list( "<<>>" = Sys.getenv("OPENAQ_API_KEY") ) ))