add tests for changing resource

This commit is contained in:
Hong Ooi 2019-09-03 19:58:02 +10:00
Родитель de82170782
Коммит db02dd2f27
2 изменённых файлов: 26 добавлений и 0 удалений

Просмотреть файл

@ -134,3 +134,15 @@ test_that("Resource owner grant works",
expect_true(is_azure_token(tok))
})
test_that("Refreshing with changed resource works",
{
res <- "https://management.azure.com/"
tok <- get_azure_token(res, tenant, cli_app)
expect_identical(res, decode_jwt(tok)$payload$aud)
tok$resource <- "https://graph.microsoft.com/"
tok$refresh()
expect_identical("https://graph.microsoft.com/", decode_jwt(tok)$payload$aud)
})

Просмотреть файл

@ -171,3 +171,17 @@ test_that("Resource owner grant works",
expect_identical(resbase, decode_jwt(tok)$payload$aud)
})
test_that("Refreshing with changed resource works",
{
res <- "https://management.azure.com/.default"
resbase <- "https://management.azure.com"
res2 <- "offline_access"
tok <- get_azure_token(c(res, res2), tenant, cli_app, version=2)
expect_identical(resbase, decode_jwt(tok)$payload$aud)
tok$scope[1] <- "https://graph.microsoft.com/.default"
tok$refresh()
expect_identical(decode_jwt(tok)$payload$aud, "https://graph.microsoft.com")
})