tests/testthat/test-ds_err_handler.R

context("test-ds_err_handler.R")

# Set up
dkanr_setup(url = 'https://data.louisvilleky.gov')

# start_capturing(path = './tests/testthat')
# ds_search(resource_id = "0000")
# stop_capturing()

httptest::with_mock_api({
  test_that("Errors from datastore API are handled correctly", {
    expect_error(ds_search(resource_id = "0000"),
                 regexp = "*503 - Service Unavailable (HTTP 503)*")
  })
})

Try the dkanr package in your browser

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

dkanr documentation built on May 1, 2019, 7:31 p.m.