tests/testthat/test-secret.R

test_that("NULLs aren't secret", {
  expect_equal(secret(NULL), NULL)
})

test_that("print and str obfuscate output", {
  expect_snapshot({
    x <- secret("THIS IS MY PASSWORD: foo")
    x
    str(x)
  })
})

test_that("can put a secret in a data frame", {
  x <- secret("x")
  df <- data.frame(x)
  expect_equal(df$x, x)
})

Try the rsconnect package in your browser

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

rsconnect documentation built on Oct. 4, 2023, 5:07 p.m.