tests/testthat/test-token.R

testthat::context(desc = "Testing data sets")


testthat::test_that(
  "Testing if data sets returns a data.frame if not authenticated", {

    df = nsrr_datasets(token = NULL)

    if (all(attributes(df)$status_code == 200)) {
      testthat::expect_is(df, "data.frame")
    }

  })

testthat::test_that("Testing if data sets returns a data.frame", {

  token = nsrr_token()
  if (!is.null(token)) {
    df = nsrr_datasets(token = token)
    if (all(attributes(df)$status_code == 200)) {
      testthat::expect_is(df, "data.frame")
    }
  }

})

Try the nsrr package in your browser

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

nsrr documentation built on July 8, 2020, 5:52 p.m.