зеркало из https://github.com/Azure/AzureKeyVault.git
initial storage testing
This commit is contained in:
Родитель
f305388803
Коммит
c95eb22c6d
|
@ -22,6 +22,7 @@ Imports:
|
|||
AzureGraph,
|
||||
AzureAuth (>= 1.0.1)
|
||||
Suggests:
|
||||
AzureStor,
|
||||
openssl,
|
||||
knitr,
|
||||
testthat
|
||||
|
|
|
@ -23,7 +23,7 @@ public=list(
|
|||
)
|
||||
attribs <- attribs[!sapply(attribs, is_empty)]
|
||||
|
||||
body <- list(id=storage_account, activeKeyName=key_name,
|
||||
body <- list(resourceId=storage_account, activeKeyName=key_name,
|
||||
autoRegenerateKey=regen_key, regenerationPeriod=regen_period,
|
||||
attributes=attribs, tags=list(...))
|
||||
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
context("Storage account client interface")
|
||||
|
||||
tenant <- Sys.getenv("AZ_TEST_TENANT_ID")
|
||||
app <- Sys.getenv("AZ_TEST_APP_ID")
|
||||
password <- Sys.getenv("AZ_TEST_PASSWORD")
|
||||
vaultname <- Sys.getenv("AZ_TEST_KEYVAULT")
|
||||
subscription <- Sys.getenv("AZ_TEST_SUBSCRIPTION")
|
||||
rgname <- Sys.getenv("AZ_TEST_KEYVAULT_RGNAME")
|
||||
storname <- Sys.getenv("AZ_TEST_KEYVAULT_STORAGE")
|
||||
|
||||
if(tenant == "" || app == "" || password == "" || vaultname == "" ||
|
||||
subscription == "" || rgname == "" || storname == "")
|
||||
skip("Storage account tests skipped: vault credentials not set")
|
||||
|
||||
vault <- key_vault$new(vaultname, tenant=tenant, app=app, password=password)
|
||||
|
||||
try({
|
||||
vault$storage$delete("stor1", confirm=FALSE)
|
||||
}, silent=TRUE)
|
||||
|
||||
|
||||
test_that("Storage account interface works",
|
||||
{
|
||||
stor <- az_rm$new(tenant, app, password)$
|
||||
get_subscription(subscription)$
|
||||
get_resource_group(rgname)$
|
||||
get_resource(type="Microsoft.Storage/storageAccounts", name=storname)
|
||||
|
||||
stor1 <- vault$storage$add("stor1", storname)
|
||||
expect_true(is.list(stor1) && stor1$value == "mysecretvalue")
|
||||
|
||||
storlist <- vault$storage$list_versions("stor1")
|
||||
expect_true(is.list(seclist) && length(seclist) == 1)
|
||||
|
||||
lst <- vault$storage$list_all()
|
||||
expect_true(is.list(lst) && length(lst) == 1)
|
||||
|
||||
backup <- vault$storage$backup("stor1")
|
||||
expect_type(backup, "character")
|
||||
})
|
||||
|
||||
vault$storage$remove("stor1", confirm=FALSE)
|
||||
|
Загрузка…
Ссылка в новой задаче