tests/testthat/test-802-client-logout.R

test_that("logout() can reset the username", {
  # Clear the environment
  set_env("CONSIBIO_USERNAME", "bob@helloworld.com")

  # Logout will reset the "CONSIBIO_USERNAME"
  logout()

  # Expect CONSIBIO_USERNAME to be empty
  testthat::expect_equal(get_username(), "")

  # Expect the user id to be empty
  testthat::expect_equal(get_env("CONSIBIO_USER_ID"), "")
})

with_mock_dir(
  "../api/logout",
  test_that("logout() works and get_users_me will throw error", {
    testthat::expect_snapshot_error(get_users_me())
  }),
  simplify = FALSE
)

Try the consibiocloudclient package in your browser

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

consibiocloudclient documentation built on Sept. 12, 2024, 9:34 a.m.