Expected `autoconnect(check = FALSE)` to throw a error.

c(EDP_API_SECRET = conn$secret, EDP_API_HOST = conn$host),
### with a URL that works but that is not EDP
withr::with_envvar(c(HOME = getwd(), USERPROFILE = getwd()), {
c(EDP_API_SECRET = TOKEN, EDP_API_HOST = "host"),
c(SOLVEBIO_ACCESS_TOKEN = TOKEN, SOLVEBIO_API_HOST = "host"),
conn <- list(secret = TOKEN, host = "host")
tmp_config <- tempfile(fileext = ".json")
save_connection_profile(conn, profile = "toto", path = tmp_config)
withr::defer(unlink(tmp_config, recursive = TRUE, force = TRUE))
we(c(EDP_PROFILE = "toto", EDP_CONFIG = tmp_config), {
on.exit(set_connection(old, check = FALSE), add = TRUE)
conn <- list(secret = strrep("X", 30), host = "host")
expect_error(set_connection(1, check = TRUE), 'no "secret" in connection')
check_connection(list(secret = strrep("X", 30), host = "host")),
check_connection(list(secret = strrep("X", 20), host = "host")),
expect_error(check_connection(list(secret = strrep("X", 20))), "host")
conn2 <- list(secret = strrep("Y", 40), host = "host2")
conn3 <- list(secret = strrep("Z", 40), host = "host3")
save_connection_profile(conn3, profile = "with_key", overwrite = TRUE)
read_connection_profile(path = "custom.creds", profile = "with_token"),
expect_error(connect(key, "host", check = FALSE))
we(c(EDP_API_SECRET = token, EDP_API_HOST = "h"), {
expect_identical(connect(check = FALSE), list(secret = token, host = "h"))
c(SOLVEBIO_API_KEY = key, EDP_API_SECRET = token, SOLVEBIO_API_HOST = "h"),
# explicit params (token) supersedes api_key via default
we(c(EDP_API_SECRET = key, EDP_API_HOST = "h"), {
we(c(SOLVEBIO_ACCESS_TOKEN = token, SOLVEBIO_API_HOST = "h"), {

Error: can not overwrite existing profile "default"

Error: can not overwrite existing profile "with_key"