tests/testthat/test-oc_username.R

test_that("the username is read correctly", {
  Sys.setenv(OPENCAST_USERNAME = "admin")
  expect_equal(oc_username(), "admin")
})

test_that("an error is thrown when the username is not set", {
  Sys.unsetenv("OPENCAST_USERNAME")
  expect_error(oc_username())
})

Try the opencastR package in your browser

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

opencastR documentation built on March 19, 2020, 5:12 p.m.