tests/testthat/test_secrets_manager.R

context("Secrets Manager")

test_that("test secret is successfully retrieved and parsed", {
  expectedSecretValue <- list(username = "secretstest", password = "secretstest")
  expect_identical(precisely.aws.SecretsManager.getSecretValue("dev/precisely.aws/secrets_test"),
                   expectedSecretValue)
})

test_that("empty and non-existent secret names result in errors", {
  expect_error(precisely.aws.SecretsManager.getSecretValue(""),
               ".*error: argument --secret-id: expected one argument")
  expect_error(precisely.aws.SecretsManager.getSecretValue("fake/secret"),
               ".*Secrets Manager can’t find the specified secret")
})
precision-analytics/precisely.aws documentation built on May 23, 2019, 6:05 p.m.