Nothing
# Offline tests for client construction. None of these touch the network.
test_that("axprism_client returns a well-formed client object", {
client <- axprism_client(api_key = "demo-key")
expect_s3_class(client, "axprism_client")
expect_identical(client$api_key, "demo-key")
expect_identical(client$base_url, "https://axprism.com")
expect_identical(client$timeout_s, 30)
expect_identical(client$max_retries, 3)
expect_identical(client$backoff_s, 0.5)
})
test_that("axprism_client honours custom settings", {
client <- axprism_client(
api_key = "k",
base_url = "https://example.test",
timeout_s = 5,
max_retries = 1,
backoff_s = 0.1
)
expect_identical(client$base_url, "https://example.test")
expect_identical(client$timeout_s, 5)
expect_identical(client$max_retries, 1)
expect_identical(client$backoff_s, 0.1)
})
test_that("trailing slashes are stripped from base_url", {
expect_identical(
axprism_client(api_key = "k", base_url = "https://axprism.com/")$base_url,
"https://axprism.com"
)
expect_identical(
axprism_client(api_key = "k", base_url = "https://axprism.com///")$base_url,
"https://axprism.com"
)
})
test_that("axprism_client errors when no API key is available", {
old <- Sys.getenv("AXPRISM_API_KEY", unset = NA)
Sys.unsetenv("AXPRISM_API_KEY")
on.exit(if (!is.na(old)) Sys.setenv(AXPRISM_API_KEY = old), add = TRUE)
expect_error(axprism_client(), "api_key is required")
})
test_that("axprism_client reads the AXPRISM_API_KEY environment variable", {
old <- Sys.getenv("AXPRISM_API_KEY", unset = NA)
Sys.setenv(AXPRISM_API_KEY = "env-key")
on.exit({
if (is.na(old)) Sys.unsetenv("AXPRISM_API_KEY") else Sys.setenv(AXPRISM_API_KEY = old)
}, add = TRUE)
expect_identical(axprism_client()$api_key, "env-key")
})
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.