library(dplyr)
skip_if_no_auth <- function() {
if (identical(Sys.getenv("client_id"), "") || identical(Sys.getenv("client_secret"), "") || identical(Sys.getenv("tenant"), "")) {
skip("No authentication available")
}
}
context("ADL Write Functions - File extensions")
test_that("file extension is correct",{
# set token if authentication is possible
if(identical(Sys.getenv("client_id"), "")){NULL
}else{
# set token
set_adl_token(tenant = Sys.getenv("tenant"), client_id = Sys.getenv("client_id"), client_secret = Sys.getenv("client_secret"))
data(band_members)
}
# if not authentication is available then skip tests
skip_if_no_auth()
expect_error(write_adl_feather(band_members, adl_file_path = Sys.getenv("adl_file_path_correct")))
})
context("ADL Write Functions - Fail on imcpmlete args")
test_that("error is thrown if parameters are not passed",{
# set token if authentication is possible
if(identical(Sys.getenv("client_id"), "")){NULL
}else{
# set token
set_adl_token(tenant = Sys.getenv("tenant"), client_id = Sys.getenv("client_id"), client_secret = Sys.getenv("client_secret"))
data(band_members)
}
# if not authentication is available then skip tests
skip_if_no_auth()
expect_error(write_adl_feather())
expect_error(write_adl_delim())
})
context("ADL Write Functions - Return 201 on complete write")
test_that("write returns success if completed",{
# set token if authentication is possible
if(identical(Sys.getenv("client_id"), "")){NULL
}else{
# set token
set_adl_token(tenant = Sys.getenv("tenant"), client_id = Sys.getenv("client_id"), client_secret = Sys.getenv("client_secret"))
data(band_members)
}
# if not authentication is available then skip tests
skip_if_no_auth()
expect_equal(write_adl_feather(df = band_members, adl_file_path = Sys.getenv("adl_file_path_correct_feather")), 201)
expect_equal(write_adl_delim(df = band_members, adl_file_path = Sys.getenv("adl_file_path_correct_delim"), delim = "|"), 201)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.