tests/testthat/test_http_error.R

message("\nTesting handling of HTTP errors")

test_that("Error for invalid endpoint", {
  skip_on_cran()
  response <- get_response("/fakeEndpoint", query = list(format = "json", api_key = get_api_key()))
  expect_error(process_json_response(response), "\\[404\\]: [a-zA-Z0-9:/.]+fakeEndpoint")
})
pamelarussell/TCIApathfinder documentation built on Feb. 11, 2021, 7:02 a.m.