tests/testthat/test_options.R

context("Options")

library(rcaspio)

test_that("api_options initializes properly", {
  api_options()
  expect_equal(api_options("endpoint"), NULL)
  expect_equal(api_options("client_id"), NULL)
  expect_equal(api_options("client_secret"), NULL)
  expect_equal(api_options("access_token"), NULL)
})

test_that("api_options set/get correctly", {
  # Endpoint
  api_options(endpoint = "my_endpoint")
  expect_equal(api_options("endpoint"), "my_endpoint")
  expect_equal(api_options("client_id"), NULL)
  expect_equal(api_options("client_secret"), NULL)
  expect_equal(api_options("access_token"), NULL)
  settings::reset(api_options)
  expect_equal(api_options("endpoint"), NULL)
})
adam-garcia/rcaspio documentation built on July 3, 2019, 12:26 a.m.