tests/testthat/test-credentials_service_account.R

test_that("check_is_service_account() errors for OAuth client", {
  # call indirectly, so we can also check the caller is reported
  PKG_auth <- function(path) {
    check_is_service_account(path, hint = "PKG_auth_configure")
  }
  expect_snapshot(
    error = TRUE,
    PKG_auth(
      fs::path_package("gargle", "extdata", "client_secret_installed.googleusercontent.com.json")
    )
  )
})

test_that("check_is_service_account() errors for invalid input", {
  # call indirectly, so we can also check the caller is reported
  PKG_auth <- function(path) {
    check_is_service_account(path, hint = "PKG_auth_configure")
  }
  expect_snapshot(
    error = TRUE,
    PKG_auth("wut")
  )
})
r-pkgs/gargle documentation built on Sept. 3, 2023, 12:22 a.m.