From 41bc59c869997167a9b79580f01c9549d771e077 Mon Sep 17 00:00:00 2001 From: Neal Richardson Date: Tue, 28 Oct 2025 08:25:58 -0400 Subject: [PATCH 1/7] Move test-connect tests to non-integration --- R/connect.R | 4 +- tests/integrated/test-connect.R | 72 ++------------------------------- tests/testthat/test-connect.R | 69 ++++++++++++++++++++++++++++++- 3 files changed, 73 insertions(+), 72 deletions(-) diff --git a/R/connect.R b/R/connect.R index 0631c8950..74d8144bf 100644 --- a/R/connect.R +++ b/R/connect.R @@ -1005,7 +1005,9 @@ connect <- function( ..., .check_is_fatal = TRUE ) { - if (is.null(api_key) || is.na(api_key) || nchar(api_key) == 0) { + if ( + missing(token) && is.null(api_key) || is.na(api_key) || nchar(api_key) == 0 + ) { msg <- "Invalid (empty) API key. Please provide a valid API key" if (.check_is_fatal) { stop(glue::glue("ERROR: {msg}")) diff --git a/tests/integrated/test-connect.R b/tests/integrated/test-connect.R index 6772cb695..c2d28487d 100644 --- a/tests/integrated/test-connect.R +++ b/tests/integrated/test-connect.R @@ -1,78 +1,12 @@ -test_that("connect works", { - conn <- connect( - server = Sys.getenv("TEST_1_SERVER"), - api_key = Sys.getenv("TEST_1_API_KEY") - ) - expect_true(validate_R6_class(conn, "Connect")) -}) - -test_that("connect works with prefix only", { - conn <- connect(prefix = "TEST_1") - expect_true(validate_R6_class(conn, "Connect")) -}) - -test_that("connect fails for nonexistent server", { - expect_error({ - connect(server = "does-not-exist.rstudio.com", api_key = "bogus") - }) +# This whole suite assumes CONNECT_SERVER and CONNECT_API_KEY env vars are set +test_that("connect() works", { + expect_true(validate_R6_class(connect(), "Connect")) }) test_that("connect fails for good server, bad api key", { expect_error({ connect( - server = Sys.getenv("TEST_1_SERVER"), api_key = "bogus" ) }) }) - -test_that("error if API key is empty", { - expect_error( - connect(server = Sys.getenv("TEST_1_SERVER"), api_key = ""), - "provide a valid API key" - ) - - expect_error( - connect(server = Sys.getenv("TEST_1_SERVER"), api_key = NA_character_), - "provide a valid API key" - ) - - expect_error( - connect(server = Sys.getenv("TEST_1_SERVER"), api_key = NULL), - "provide a valid API key" - ) -}) - -test_that(".check_is_fatal toggle works", { - expect_error( - connect(server = Sys.getenv("TEST_1_SERVER"), api_key = ""), - "provide a valid API key" - ) - - rsc <- connect( - server = Sys.getenv("TEST_1_SERVER"), - api_key = "", - .check_is_fatal = FALSE - ) - expect_true( - validate_R6_class(rsc, "Connect") - ) - - expect_error( - suppressMessages(connect( - server = "http://fake-value.example.com", - api_key = "fake-value" - )), - "Could not resolve host" - ) - - # TODO: suppressing the message in the tryCatch handler does not work...? - rsc1 <- suppressMessages(connect( - server = "http://fake-value.example.com", - api_key = "fake-value", - .check_is_fatal = FALSE - )) - expect_true( - validate_R6_class(rsc1, "Connect") - ) -}) diff --git a/tests/testthat/test-connect.R b/tests/testthat/test-connect.R index 27a427ba5..e18604f7b 100644 --- a/tests/testthat/test-connect.R +++ b/tests/testthat/test-connect.R @@ -29,6 +29,71 @@ test_that("error if protocol not defined", { ) }) +test_that("connect() errors if API key is empty", { + expect_error( + connect(api_key = ""), + "provide a valid API key" + ) + + expect_error( + connect(api_key = NA_character_), + "provide a valid API key" + ) + + expect_error( + connect(api_key = NULL), + "provide a valid API key" + ) +}) + +test_that("connect() just warns on empty API key if .check_is_fatal=FALSE", { + # Use without_internet() because for some reason it doesn't return early + # if there is no API key. + without_internet({ + expect_message( + client <- connect( + api_key = "", + .check_is_fatal = FALSE + ), + "provide a valid API key" + ) + expect_true( + validate_R6_class(client, "Connect") + ) + }) +}) + +test_that("connect() fails for bad server", { + without_internet({ + expect_error( + connect(server = "does-not-exist.rstudio.com", api_key = "bogus"), + "Please provide a protocol" + ) + # This is how without_internet() errors making the ping request + expect_error( + connect(server = "http://does-not-exist.rstudio.com", api_key = "bogus"), + "GET http://does-not-exist.rstudio.com/__ping__" + ) + }) +}) + +test_that(".check_is_fatal toggle handles server validation", { + without_internet({ + # See above. But the error is caught and returned as a message in this case. + expect_message( + client <- connect( + server = "http://fake-value.example.com", + api_key = "fake-value", + .check_is_fatal = FALSE + ), + "GET http://fake-value.example.com/__ping__" + ) + expect_true( + validate_R6_class(client, "Connect") + ) + }) +}) + test_that("version is validated", { skip("not implemented yet") }) @@ -95,8 +160,8 @@ test_that("Handling deprecation warnings", { expect_warning(check_debug(resp), NA) withr::with_options( - list(rlib_warning_verbosity = "default"), { - + list(rlib_warning_verbosity = "default"), + { # Yes warning here resp <- fake_response( "https://connect.example/__api__/", From 2e50b82282491ad5f3f1dcc1b3f6a0af59d36ee1 Mon Sep 17 00:00:00 2001 From: Neal Richardson Date: Tue, 28 Oct 2025 08:35:09 -0400 Subject: [PATCH 2/7] Remove prefix arg from connect() and just use usual env vars everywhere --- .github/workflows/integration-tests.yaml | 8 +-- .github/workflows/pkgdown.yaml | 7 +- .github/workflows/test-coverage.yaml | 7 +- R/connect.R | 9 +-- R/deploy.R | 5 +- man/bundle_dir.Rd | 2 +- man/bundle_path.Rd | 2 +- man/bundle_static.Rd | 2 +- man/connect.Rd | 12 ++-- man/deploy.Rd | 4 +- tests/integrated/setup.R | 2 +- tests/integrated/test-content.R | 52 +++++++-------- tests/integrated/test-deploy.R | 67 +++++++++---------- tests/integrated/test-deployment.R | 49 +++++++------- tests/integrated/test-env-vars.R | 4 +- tests/integrated/test-get.R | 32 ++++----- tests/integrated/test-git.R | 28 ++++---- tests/integrated/test-groups.R | 16 ++--- tests/integrated/test-lazy.R | 18 ++--- tests/integrated/test-misc.R | 8 +-- tests/integrated/test-run-as.R | 4 +- tests/integrated/test-schedule.R | 8 +-- tests/integrated/test-tags.R | 78 +++++++++++----------- tests/integrated/test-users.R | 18 ++--- tests/integrated/test-variant.R | 4 +- tests/test-integrated.R | 2 +- vignettes/articles/connectapi_tags.Rmd | 2 +- vignettes/articles/content_permissions.Rmd | 2 +- 28 files changed, 212 insertions(+), 240 deletions(-) diff --git a/.github/workflows/integration-tests.yaml b/.github/workflows/integration-tests.yaml index de1ff041f..df14feaca 100644 --- a/.github/workflows/integration-tests.yaml +++ b/.github/workflows/integration-tests.yaml @@ -53,11 +53,5 @@ jobs: with: version: ${{ matrix.version }} license: ${{ secrets.CONNECT_LICENSE_FILE }} - # TODO: rewrite tests to use CONNECT_* env vars directly command: | - Rscript -e ' - Sys.setenv( - TEST_1_SERVER=Sys.getenv("CONNECT_SERVER"), - TEST_1_API_KEY=Sys.getenv("CONNECT_API_KEY") - ) - source("tests/test-integrated.R")' + Rscript -e 'source("tests/test-integrated.R")' diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index cef58d064..0117a5bf9 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -40,12 +40,7 @@ jobs: license: ${{ secrets.CONNECT_LICENSE_FILE }} # TODO: rewrite tests to use CONNECT_* env vars directly command: | - Rscript -e ' - Sys.setenv( - TEST_1_SERVER=Sys.getenv("CONNECT_SERVER"), - TEST_1_API_KEY=Sys.getenv("CONNECT_API_KEY") - ) - pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)' + Rscript -e 'pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)' - name: Deploy to GitHub pages 🚀 if: github.event_name != 'pull_request' diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index d39c5d820..d9b06c4bc 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -38,16 +38,11 @@ jobs: # TODO: rewrite tests to use CONNECT_* env vars directly command: | Rscript -e ' - Sys.setenv( - TEST_1_SERVER=Sys.getenv("CONNECT_SERVER"), - TEST_1_API_KEY=Sys.getenv("CONNECT_API_KEY") - ) - token <- "${{ secrets.CODECOV_TOKEN }}" covr::codecov( quiet = FALSE, clean = FALSE, install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package"), - token = if (token != "") token + token = "${{ secrets.CODECOV_TOKEN }}" )' diff --git a/R/connect.R b/R/connect.R index 74d8144bf..32f0688c2 100644 --- a/R/connect.R +++ b/R/connect.R @@ -963,7 +963,6 @@ Connect <- R6::R6Class( #' `Connect` object using the `api_key`. By providing a different #' key here you can test a visitor client with differently-scoped #' permissions. -#' @param prefix The prefix used to determine environment variables #' @param audience Optional. The GUID of a Connect API integration associated with this piece of content. #' @param ... Additional arguments. Not used at present #' @param .check_is_fatal Whether to fail if "check" requests fail. Useful in @@ -991,16 +990,14 @@ Connect <- R6::R6Class( #' @examplesIf identical(Sys.getenv("IN_PKGDOWN"), "true") #' #' # default is to read CONNECT_SERVER and CONNECT_API_KEY environment variables -#' # this example will read TEST_1_SERVER and TEST_1_API_KEY -#' connect(prefix = "TEST_1") +#' connect() #' #' @export connect <- function( - server = Sys.getenv(paste0(prefix, "_SERVER"), NA_character_), - api_key = Sys.getenv(paste0(prefix, "_API_KEY"), NA_character_), + server = Sys.getenv("CONNECT_SERVER"), + api_key = Sys.getenv("CONNECT_API_KEY"), token, token_local_testing_key = api_key, - prefix = "CONNECT", audience = NULL, ..., .check_is_fatal = TRUE diff --git a/R/deploy.R b/R/deploy.R index 7239f617e..854803d2d 100644 --- a/R/deploy.R +++ b/R/deploy.R @@ -402,7 +402,7 @@ download_bundle <- function( #' } #' @examplesIf identical(Sys.getenv("IN_PKGDOWN"), "true") #' -#' client <- connect(prefix = "TEST_1") +#' client <- connect() #' bnd <- bundle_path(system.file("tests/testthat/examples/static.tar.gz", package = "connectapi")) #' deploy(client, bnd) #' @@ -413,8 +413,7 @@ deploy <- function( title = name, guid = NULL, ..., - .pre_deploy = { - } + .pre_deploy = {} ) { validate_R6_class(bundle, "Bundle") validate_R6_class(connect, "Connect") diff --git a/man/bundle_dir.Rd b/man/bundle_dir.Rd index 47d7c865a..272fd84a5 100644 --- a/man/bundle_dir.Rd +++ b/man/bundle_dir.Rd @@ -21,7 +21,7 @@ Bundle A bundle object Creates a bundle from a target directory. } \examples{ -\dontshow{if (identical(Sys.getenv("IN_PKGDOWN"), "true")) withAutoprint(\{ # examplesIf} +\dontshow{if (identical(Sys.getenv("IN_PKGDOWN"), "true")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} bundle_dir(system.file("tests/testthat/examples/shiny/", package = "connectapi")) \dontshow{\}) # examplesIf} diff --git a/man/bundle_path.Rd b/man/bundle_path.Rd index 586e0d119..7eff4f3c4 100644 --- a/man/bundle_path.Rd +++ b/man/bundle_path.Rd @@ -16,7 +16,7 @@ Bundle A bundle object Define a bundle from a path (a path directly to a tar.gz file) } \examples{ -\dontshow{if (identical(Sys.getenv("IN_PKGDOWN"), "true")) withAutoprint(\{ # examplesIf} +\dontshow{if (identical(Sys.getenv("IN_PKGDOWN"), "true")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} bundle_path(system.file("tests/testthat/examples/static.tar.gz", package = "connectapi")) \dontshow{\}) # examplesIf} diff --git a/man/bundle_static.Rd b/man/bundle_static.Rd index 0a7559598..bc855f147 100644 --- a/man/bundle_static.Rd +++ b/man/bundle_static.Rd @@ -26,7 +26,7 @@ directory, generates a basic manifest file (using the first file as the NOTE: the \code{rsconnect} package is required for this function to work properly. } \examples{ -\dontshow{if (identical(Sys.getenv("IN_PKGDOWN"), "true")) withAutoprint(\{ # examplesIf} +\dontshow{if (identical(Sys.getenv("IN_PKGDOWN"), "true")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} bundle_static(system.file("logo.png", package = "connectapi")) \dontshow{\}) # examplesIf} diff --git a/man/connect.Rd b/man/connect.Rd index c0b68c186..ce0e2bd47 100644 --- a/man/connect.Rd +++ b/man/connect.Rd @@ -5,11 +5,10 @@ \title{Create a connection to Posit Connect} \usage{ connect( - server = Sys.getenv(paste0(prefix, "_SERVER"), NA_character_), - api_key = Sys.getenv(paste0(prefix, "_API_KEY"), NA_character_), + server = Sys.getenv("CONNECT_SERVER"), + api_key = Sys.getenv("CONNECT_API_KEY"), token, token_local_testing_key = api_key, - prefix = "CONNECT", audience = NULL, ..., .check_is_fatal = TRUE @@ -32,8 +31,6 @@ Connect and a \code{token} is provided. By default, the function returns a key here you can test a visitor client with differently-scoped permissions.} -\item{prefix}{The prefix used to determine environment variables} - \item{audience}{Optional. The GUID of a Connect API integration associated with this piece of content.} \item{...}{Additional arguments. Not used at present} @@ -75,10 +72,9 @@ fallback_key <- Sys.getenv("VIEWER_ROLE_API_KEY") client <- connect(token = token, token_local_testing_key = fallback_key) } -\dontshow{if (identical(Sys.getenv("IN_PKGDOWN"), "true")) withAutoprint(\{ # examplesIf} +\dontshow{if (identical(Sys.getenv("IN_PKGDOWN"), "true")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # default is to read CONNECT_SERVER and CONNECT_API_KEY environment variables -# this example will read TEST_1_SERVER and TEST_1_API_KEY -connect(prefix = "TEST_1") +connect() \dontshow{\}) # examplesIf} } diff --git a/man/deploy.Rd b/man/deploy.Rd index 394ce63a5..5630b561a 100644 --- a/man/deploy.Rd +++ b/man/deploy.Rd @@ -60,9 +60,9 @@ bnd <- bundle_dir(".") deploy(client, bnd) } -\dontshow{if (identical(Sys.getenv("IN_PKGDOWN"), "true")) withAutoprint(\{ # examplesIf} +\dontshow{if (identical(Sys.getenv("IN_PKGDOWN"), "true")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} -client <- connect(prefix = "TEST_1") +client <- connect() bnd <- bundle_path(system.file("tests/testthat/examples/static.tar.gz", package = "connectapi")) deploy(client, bnd) \dontshow{\}) # examplesIf} diff --git a/tests/integrated/setup.R b/tests/integrated/setup.R index ff8cbfddf..739030b56 100644 --- a/tests/integrated/setup.R +++ b/tests/integrated/setup.R @@ -1 +1 @@ -test_conn_1 <- connect(prefix = "TEST_1") +client <- connect() diff --git a/tests/integrated/test-content.R b/tests/integrated/test-content.R index 958e7df12..d9580a679 100644 --- a/tests/integrated/test-content.R +++ b/tests/integrated/test-content.R @@ -5,30 +5,30 @@ viewer_guid <- NULL # deploy content cont1_title <- "Test Content 1" -cont1_content <- deploy_example(test_conn_1, "static", title = cont1_title) +cont1_content <- deploy_example(client, "static", title = cont1_title) cont1_guid <- cont1_content$content$guid # Metadata Tests ---------------------------------------------------- test_that("content_item works", { - cont1_tmp <- test_conn_1 %>% content_item(guid = cont1_guid) + cont1_tmp <- client %>% content_item(guid = cont1_guid) expect_true(validate_R6_class(cont1_tmp, "Content")) expect_equal(cont1_tmp$content$guid, cont1_guid) }) test_that("content_title works in a simple example", { - test_title <- content_title(test_conn_1, cont1_guid) + test_title <- content_title(client, cont1_guid) expect_identical(test_title, cont1_title) }) test_that("content_title handles missing content gracefully", { - null_title <- content_title(test_conn_1, "not_a_real_guid") + null_title <- content_title(client, "not_a_real_guid") expect_identical(null_title, "Unknown Content") null_title_custom <- content_title( - test_conn_1, + client, "not_a_real_guid", "other-default" ) @@ -42,9 +42,9 @@ test_that("content_title handles NULL titles gracefully", { "tests/testthat/examples/static/test.png" ) ) - c2 <- deploy(connect = test_conn_1, bundle = bnd, name = c2_name, title = NA) + c2 <- deploy(connect = client, bundle = bnd, name = c2_name, title = NA) expect_null(c2$content$title) - null_title <- content_title(test_conn_1, c2$content$guid, "Test Title") + null_title <- content_title(client, c2$content$guid, "Test Title") expect_identical(null_title, "Test Title") }) @@ -54,16 +54,16 @@ test_that("content_update_owner works", { "tests/testthat/examples/static/test.png" ) ) - myc <- deploy(test_conn_1, bnd) + myc <- deploy(client, bnd) - new_user <- test_conn_1$users_create( + new_user <- client$users_create( username = glue::glue("test_admin_{create_random_name()}"), email = "example@example.com", user_role = "administrator", user_must_set_password = TRUE ) - expect_equal(myc$get_content_remote()$owner_guid, test_conn_1$me()$guid) + expect_equal(myc$get_content_remote()$owner_guid, client$me()$guid) res <- content_update_owner(myc, new_user$guid) @@ -73,18 +73,18 @@ test_that("content_update_owner works", { ) # permissions do not remain - expect_null(get_user_permission(myc, test_conn_1$me()$guid)) + expect_null(get_user_permission(myc, client$me()$guid)) # switch back (as an admin) - res2 <- content_update_owner(myc, test_conn_1$me()$guid) + res2 <- content_update_owner(myc, client$me()$guid) - expect_equal(myc$get_content_remote()$owner_guid, test_conn_1$me()$guid) + expect_equal(myc$get_content_remote()$owner_guid, client$me()$guid) # permissions do not remain expect_null(get_user_permission(myc, new_user$guid)) # viewer cannot be made an owner - viewer_user <- test_conn_1$users_create( + viewer_user <- client$users_create( username = glue::glue("test_viewer_{create_random_name()}"), email = "viewer@example.com", user_role = "viewer", @@ -106,7 +106,7 @@ test_that("content_update_access_type works", { ) bund <- bundle_path(path = tar_path) - tsk <- deploy(connect = test_conn_1, bundle = bund) + tsk <- deploy(connect = client, bundle = bund) # returns as expected tsk <- content_update_access_type(tsk, "all") @@ -130,7 +130,7 @@ test_that("content_update works", { ) bund <- bundle_path(path = tar_path) - tsk <- deploy(connect = test_conn_1, bundle = bund) + tsk <- deploy(connect = client, bundle = bund) content_update(tsk, title = "test content_update") expect_equal(tsk$content$title, "test content_update") @@ -150,7 +150,7 @@ test_that("content_delete works", { ) bund <- bundle_path(path = tar_path) - tsk <- deploy(connect = test_conn_1, bundle = bund) + tsk <- deploy(connect = client, bundle = bund) expect_message(res <- content_delete(tsk, force = TRUE), "Deleting content") expect_true(validate_R6_class(res, "Content")) @@ -172,9 +172,9 @@ test_that("get_bundles and delete_bundle work", { ) ) - bc1 <- deploy(test_conn_1, bnd, bnd_name) - bc1 <- deploy(test_conn_1, bnd, bnd_name) - bc1 <- deploy(test_conn_1, bnd, bnd_name) + bc1 <- deploy(client, bnd, bnd_name) + bc1 <- deploy(client, bnd, bnd_name) + bc1 <- deploy(client, bnd, bnd_name) bnd_dat <- get_bundles(bc1) expect_equal(nrow(bnd_dat), 3) @@ -196,8 +196,8 @@ test_that("returns owner permission", { "tests/testthat/examples/static.tar.gz" ) bund <- bundle_path(path = tar_path) - tsk <- deploy(connect = test_conn_1, bundle = bund) - my_guid <- test_conn_1$GET("me")$guid + tsk <- deploy(connect = client, bundle = bund) + my_guid <- client$GET("me")$guid prm <- get_content_permissions(tsk) expect_length(prm[["id"]], 1) @@ -218,7 +218,7 @@ test_that("returns owner permission", { test_that("add a collaborator works", { # create a user - collab <- test_conn_1$users_create( + collab <- client$users_create( username = glue::glue("test_collab{create_random_name()}"), email = "collab@example.com", user_must_set_password = TRUE, @@ -256,7 +256,7 @@ test_that("add collaborator twice works", { test_that("add a viewer works", { # create a user - view_user <- test_conn_1$users_create( + view_user <- client$users_create( username = glue::glue("test_viewer{create_random_name()}"), email = "viewer@example.com", user_must_set_password = TRUE, @@ -341,13 +341,13 @@ test_that("remove a collaborator twice works", { # Lock / Unlock ----------------------------------------- test_that("lock and unlock content works", { - skip_if_connect_older_than(test_conn_1, "2024.08.0") + skip_if_connect_older_than(client, "2024.08.0") tar_path <- rprojroot::find_package_root_file( "tests/testthat/examples/static.tar.gz" ) bund <- bundle_path(path = tar_path) - tsk <- deploy(connect = test_conn_1, bundle = bund) + tsk <- deploy(connect = client, bundle = bund) # Lock with message lock_content(tsk, locked_message = "Maintenance in progress") diff --git a/tests/integrated/test-deploy.R b/tests/integrated/test-deploy.R index 66d24507a..865d2c9da 100644 --- a/tests/integrated/test-deploy.R +++ b/tests/integrated/test-deploy.R @@ -15,12 +15,12 @@ test_that("bundle_static deploys", { ) ) uniq_id <- uuid::UUIDgenerate() - deployed <- deploy(test_conn_1, bnd, uniq_id) + deployed <- deploy(client, bnd, uniq_id) expect_true(validate_R6_class(bnd, "Bundle")) expect_true(validate_R6_class(deployed, "Content")) - deployed2 <- deploy(test_conn_1, bnd, uniq_id) + deployed2 <- deploy(client, bnd, uniq_id) expect_true(validate_R6_class(deployed2, "Content")) }) @@ -35,7 +35,7 @@ test_that("bundle_dir deploys", { # with a name / title tsk <- deploy( - connect = test_conn_1, + connect = client, bundle = bund, name = cont1_name, title = cont1_title @@ -53,7 +53,7 @@ test_that("bundle_dir deploys", { expect_gt(nchar(tsk$get_task()$task_id), 0) # with a guid - tsk2 <- deploy(connect = test_conn_1, bundle = bund, guid = cont1_guid) + tsk2 <- deploy(connect = client, bundle = bund, guid = cont1_guid) expect_true(validate_R6_class(tsk2, "Content")) expect_equal(tsk2$content$name, cont1_name) expect_equal(tsk2$content$title, cont1_title) @@ -69,7 +69,7 @@ test_that("bundle_path deploys", { expect_equal(tar_path, as.character(bund$path)) # deploy to a new endpoint - tsk <- deploy(connect = test_conn_1, bundle = bund) + tsk <- deploy(connect = client, bundle = bund) # TODO: how should we test that deployment happened? expect_true(validate_R6_class(tsk, "Content")) @@ -81,7 +81,7 @@ test_that("download_bundle works", { ) bund <- bundle_path(path = tar_path) - tsk <- deploy(connect = test_conn_1, bundle = bund) + tsk <- deploy(connect = client, bundle = bund) poll_task(tsk) downloaded <- download_bundle(tsk) @@ -101,12 +101,12 @@ test_that("delete_bundle() and get_bundles() work", { ) bund <- bundle_path(path = tar_path) - tsk <- deploy(connect = test_conn_1, bundle = bund) + tsk <- deploy(connect = client, bundle = bund) poll_task(tsk) first_bnd <- tsk$get_content_remote()$bundle_id my_guid <- tsk$content$guid - tsk <- deploy(connect = test_conn_1, bundle = bund, guid = my_guid) + tsk <- deploy(connect = client, bundle = bund, guid = my_guid) poll_task(tsk) second_bnd <- tsk$get_content_remote()$bundle_id @@ -142,12 +142,12 @@ test_that("strange name re-casing does not break things", { ) ) testname <- "test_Test_45" - deploy1 <- deploy(test_conn_1, bnd, testname) - deploy2 <- deploy(test_conn_1, bnd, testname) + deploy1 <- deploy(client, bnd, testname) + deploy2 <- deploy(client, bnd, testname) testname2 <- "test_Test" - deploy(test_conn_1, bnd, testname2) - deploy(test_conn_1, bnd, testname2) + deploy(client, bnd, testname2) + deploy(client, bnd, testname2) }) test_that(".pre_deploy hook works", { @@ -157,7 +157,7 @@ test_that(".pre_deploy hook works", { "tests/testthat/examples/static/test.png" ) ) - deployed <- deploy(test_conn_1, bnd, uuid::UUIDgenerate(), .pre_deploy = { + deployed <- deploy(client, bnd, uuid::UUIDgenerate(), .pre_deploy = { content %>% set_vanity_url(glue::glue("pre_deploy_{bundle_id}")) }) @@ -174,7 +174,7 @@ test_that("deploy_current works", { ) bund <- bundle_path(path = tar_path) - tsk <- deploy(connect = test_conn_1, bundle = bund) + tsk <- deploy(connect = client, bundle = bund) poll_task(tsk) created <- tsk$get_content_remote()$created_time @@ -330,7 +330,7 @@ test_that("set_vanity_url works", { "tests/testthat/examples/static/test.png" ) ) - cont1 <- deploy(test_conn_1, bnd, name = new_name) + cont1 <- deploy(client, bnd, name = new_name) res <- set_vanity_url(cont1, new_name) expect_true(validate_R6_class(res, "Vanity")) @@ -348,11 +348,11 @@ test_that("set_vanity_url force works", { "tests/testthat/examples/static/test.png" ) ) - cont <- deploy(test_conn_1, bnd, name = new_name) + cont <- deploy(client, bnd, name = new_name) res <- set_vanity_url(cont, new_name) another_name <- uuid::UUIDgenerate() - cont2 <- deploy(test_conn_1, bnd, name = another_name) + cont2 <- deploy(client, bnd, name = another_name) expect_error(suppressMessages( set_vanity_url(cont2, new_name, force = FALSE), @@ -371,8 +371,8 @@ test_that("set_vanity_url force works", { test_that("get_vanity_url works", { tmp_content_name <- uuid::UUIDgenerate() - tmp_content_prep <- content_ensure(test_conn_1, name = tmp_content_name) - tmp_content <- Content$new(connect = test_conn_1, content = tmp_content_prep) + tmp_content_prep <- content_ensure(client, name = tmp_content_name) + tmp_content <- Content$new(connect = client, content = tmp_content_prep) # without a vanity curr_vanity <- suppressMessages(get_vanity_url(tmp_content)) @@ -387,8 +387,8 @@ test_that("get_vanity_url works", { test_that("delete_vanity_url works", { tmp_content_name <- uuid::UUIDgenerate() - tmp_content_prep <- content_ensure(test_conn_1, name = tmp_content_name) - tmp_content <- Content$new(connect = test_conn_1, content = tmp_content_prep) + tmp_content_prep <- content_ensure(client, name = tmp_content_name) + tmp_content <- Content$new(connect = client, content = tmp_content_prep) # create a vanity res <- set_vanity_url(tmp_content, tmp_content_name) @@ -407,16 +407,16 @@ test_that("delete_vanity_url works", { test_that("swap_vanity_urls works", { tmp_content_a_name <- uuid::UUIDgenerate() - tmp_content_a_prep <- content_ensure(test_conn_1, name = tmp_content_a_name) + tmp_content_a_prep <- content_ensure(client, name = tmp_content_a_name) tmp_content_a <- Content$new( - connect = test_conn_1, + connect = client, content = tmp_content_a_prep ) tmp_content_b_name <- uuid::UUIDgenerate() - tmp_content_b_prep <- content_ensure(test_conn_1, name = tmp_content_b_name) + tmp_content_b_prep <- content_ensure(client, name = tmp_content_b_name) tmp_content_b <- Content$new( - connect = test_conn_1, + connect = client, content = tmp_content_b_prep ) @@ -461,14 +461,14 @@ test_that("poll_task works and returns its input", { }) test_that("download_bundle works", { - bnd <- download_bundle(content_item(test_conn_1, cont1_guid)) + bnd <- download_bundle(content_item(client, cont1_guid)) expect_true(validate_R6_class(bnd, "Bundle")) }) test_that("download_bundle throws an error for undeployed content", { - cont_prep <- content_ensure(test_conn_1) - cont <- content_item(test_conn_1, cont_prep$guid) + cont_prep <- content_ensure(client) + cont <- content_item(client, cont_prep$guid) expect_error( download_bundle(cont), @@ -477,7 +477,7 @@ test_that("download_bundle throws an error for undeployed content", { }) test_that("dashboard_url resolves properly", { - cont <- content_item(test_conn_1, cont1_guid) + cont <- content_item(client, cont1_guid) dash_url <- dashboard_url(cont) @@ -490,14 +490,13 @@ test_that("deployment timestamps respect timezone", { "tests/testthat/examples/static/test.png" ) ) - myc <- deploy(test_conn_1, bnd) + myc <- deploy(client, bnd) myc_guid <- myc$content$guid # will fail without the png package - invisible(tryCatch(test_conn_1$GET(url = myc$get_url()), error = function(e) { - })) + invisible(tryCatch(client$GET(url = myc$get_url()), error = function(e) {})) - all_usage <- get_usage_static(test_conn_1, content_guid = myc_guid) + all_usage <- get_usage_static(client, content_guid = myc_guid) for (i in 1:5) { if (nrow(all_usage) == 0) { # We may need to wait a beat for the metrics to show up. @@ -505,7 +504,7 @@ test_that("deployment timestamps respect timezone", { # This did not show up testing against Connect versions <= 2022.09.0, # but 2023.03.0 and newer seemed to hit this Sys.sleep(1) - all_usage <- get_usage_static(test_conn_1, content_guid = myc_guid) + all_usage <- get_usage_static(client, content_guid = myc_guid) } } expect_equal(nrow(all_usage), 1) diff --git a/tests/integrated/test-deployment.R b/tests/integrated/test-deployment.R index a055f4ff9..86920a21d 100644 --- a/tests/integrated/test-deployment.R +++ b/tests/integrated/test-deployment.R @@ -4,12 +4,12 @@ cont1_guid <- NULL cont1_bundle <- NULL test_that("can create content", { - cont1 <- test_conn_1$content_create(name = cont1_name, title = cont1_title) + cont1 <- client$content_create(name = cont1_name, title = cont1_title) expect_equal(cont1$name, cont1_name) expect_equal(cont1$title, cont1_title) # Use include = NULL because we aren't passing the include in content_create() - get_cont1 <- test_conn_1$content(guid = cont1$guid, include = NULL) + get_cont1 <- client$content(guid = cont1$guid, include = NULL) expect_identical(get_cont1, cont1) cont1_guid <<- cont1$guid }) @@ -20,14 +20,14 @@ test_that("can upload and deploy content", { ) expect_true(fs::file_exists(cont1_bundle$path)) - res <- test_conn_1$content_upload( + res <- client$content_upload( bundle_path = cont1_bundle$path, guid = cont1_guid ) expect_false(is.null(res)) expect_silent(as.integer(res[["bundle_id"]])) - task <- test_conn_1$content_deploy( + task <- client$content_deploy( guid = cont1_guid, bundle_id = res[["bundle_id"]] ) @@ -35,27 +35,24 @@ test_that("can upload and deploy content", { }) test_that("can promote content to another server", { - tryCatch( - test_conn_2 <- connect(prefix = "TEST_2"), - error = function(e) { - skip("Second test server not available") - } - ) + # In practice, you would have this be a different server, but we should be + # able to test using the same server. + client2 <- connect() # TODO : Intermittent failures here... with a 404 response on GET # during the download_bundle... connect.R:154 res <- promote( - from = Sys.getenv("TEST_1_SERVER"), - from_key = Sys.getenv("TEST_1_API_KEY"), - to = Sys.getenv("TEST_2_SERVER"), - to_key = Sys.getenv("TEST_2_API_KEY"), + from = Sys.getenv("CONNECT_SERVER"), + from_key = Sys.getenv("CONNECT_API_KEY"), + to = Sys.getenv("CONNECT_SERVER"), + to_key = Sys.getenv("CONNECT_API_KEY"), name = cont1_name ) expect_type(res, "character") cont1_2 <- content_ensure( - connect = test_conn_2, + connect = client2, name = cont1_name ) @@ -63,22 +60,22 @@ test_that("can promote content to another server", { }) test_that("content_ensure works with guid", { - c1 <- content_ensure(test_conn_1, guid = cont1_guid) + c1 <- content_ensure(client, guid = cont1_guid) expect_identical(c1[["guid"]], cont1_guid) fake_guid <- paste0(cont1_guid, "-does-not-exist") expect_warning({ - c2 <- content_ensure(test_conn_1, guid = fake_guid) + c2 <- content_ensure(client, guid = fake_guid) }) expect_false(identical(c2[["guid"]], cont1_guid)) }) test_that("content_ensure works with name", { - expect_message(c_new <- content_ensure(test_conn_1)) + expect_message(c_new <- content_ensure(client)) expect_type(c_new[["guid"]], "character") expect_message( - c_same <- content_ensure(test_conn_1, name = c_new[["name"]]) + c_same <- content_ensure(client, name = c_new[["name"]]) ) expect_identical(c_new[["name"]], c_same[["name"]]) @@ -89,7 +86,7 @@ test_that("content_ensure works with name", { c_desc <- "Some Description" expect_message( c_diff <- content_ensure( - test_conn_1, + client, name = c_newname, title = c_title, description = c_desc @@ -109,30 +106,30 @@ test_that("content_ensure fails when not permitted", { # duplicates to ensure it does not create expect_error( - content_ensure(test_conn_1, guid = permit_guid, .permitted = c("existing")), + content_ensure(client, guid = permit_guid, .permitted = c("existing")), "not found on" ) expect_error( - content_ensure(test_conn_1, guid = permit_guid, .permitted = c("existing")), + content_ensure(client, guid = permit_guid, .permitted = c("existing")), "not found on" ) # duplicates to ensure it does not create expect_error( - content_ensure(test_conn_1, name = permit_name, .permitted = c("existing")), + content_ensure(client, name = permit_name, .permitted = c("existing")), "not found on" ) expect_error( - content_ensure(test_conn_1, name = permit_name, .permitted = c("existing")), + content_ensure(client, name = permit_name, .permitted = c("existing")), "not found on" ) # actually create - invisible(content_ensure(test_conn_1, name = permit_name)) + invisible(content_ensure(client, name = permit_name)) # error because we expect new expect_error( - content_ensure(test_conn_1, name = permit_name, .permitted = c("new")), + content_ensure(client, name = permit_name, .permitted = c("new")), "already exists" ) }) diff --git a/tests/integrated/test-env-vars.R b/tests/integrated/test-env-vars.R index f55ecb898..c7d44432c 100644 --- a/tests/integrated/test-env-vars.R +++ b/tests/integrated/test-env-vars.R @@ -1,9 +1,9 @@ # Temporarily skip these on newer Connect versions because the manifest for this # content specifies an old version of R not found in newer images. -skip_if(safe_server_version(test_conn_1) > "2024.03.0") +skip_if(safe_server_version(client) > "2024.03.0") # ensure that RSPM is being used so these do not take eternity -rmd_content <- deploy_example(test_conn_1, "rmarkdown") +rmd_content <- deploy_example(client, "rmarkdown") test_that("get_environment works with no environment variables", { env <- get_environment(rmd_content) diff --git a/tests/integrated/test-get.R b/tests/integrated/test-get.R index 0e41106cc..08790c428 100644 --- a/tests/integrated/test-get.R +++ b/tests/integrated/test-get.R @@ -7,7 +7,7 @@ cont1_content <- NULL # get -------------------------------------------- test_that("get_users works", { - users <- get_users(test_conn_1) + users <- get_users(client) expect_s3_class(users, c("tbl_df", "tbl", "data.frame")) expect_equal( @@ -17,15 +17,15 @@ test_that("get_users works", { # Other tests create users, so specifying the exact number here is conditional # on the contents of other tests and the order that tests run in. - admins <- get_users(test_conn_1, user_role = "administrator") + admins <- get_users(client, user_role = "administrator") expect_true(nrow(admins) > 0) - licensed <- get_users(test_conn_1, account_status = "licensed") + licensed <- get_users(client, account_status = "licensed") expect_true(nrow(licensed) > 0) }) test_that("get_groups works", { - groups_list <- get_groups(test_conn_1) + groups_list <- get_groups(client) expect_s3_class(groups_list, c("tbl_df", "tbl", "data.frame")) expect_ptype_equal(groups_list, connectapi_ptypes$groups) @@ -33,7 +33,7 @@ test_that("get_groups works", { test_that("get_content works", { scoped_experimental_silence() - content_list <- get_content(test_conn_1) + content_list <- get_content(client) expect_s3_class(content_list, c("tbl_df", "tbl", "data.frame")) # various attributes have been added over the years, so exact match @@ -42,14 +42,14 @@ test_that("get_content works", { }) test_that("get_usage_shiny works", { - shiny_usage <- get_usage_shiny(test_conn_1) + shiny_usage <- get_usage_shiny(client) expect_s3_class(shiny_usage, c("tbl_df", "tbl", "data.frame")) expect_ptype_equal(shiny_usage, connectapi_ptypes$usage_shiny) }) test_that("get_usage_static works", { - content_visits <- get_usage_static(test_conn_1) + content_visits <- get_usage_static(client) expect_s3_class(content_visits, c("tbl_df", "tbl", "data.frame")) # path was added to usage_static in 2024 @@ -61,17 +61,17 @@ test_that("get_usage_static works", { }) test_that("get_audit_logs works", { - audit_list <- get_audit_logs(test_conn_1) + audit_list <- get_audit_logs(client) expect_s3_class(audit_list, c("tbl_df", "tbl", "data.frame")) # This is different on older versions, not sure it's worth worrying about how - skip_if_connect_older_than(test_conn_1, "2022.09.0") + skip_if_connect_older_than(client, "2022.09.0") expect_ptype_equal(audit_list, connectapi_ptypes$audit_logs) }) test_that("get_procs works", { scoped_experimental_silence() - proc_data <- get_procs(test_conn_1) + proc_data <- get_procs(client) # TODO: This is not a great test, since no processes are running # we could always start a content restoration... @@ -86,7 +86,7 @@ test_that("content_list_with_permissions works", { rlang::with_options( progress_enabled = FALSE, - cl <- content_list_with_permissions(test_conn_1) + cl <- content_list_with_permissions(client) ) expect_true("permission" %in% names(cl)) @@ -103,12 +103,12 @@ test_that("content_list_with_permissions predicate works", { ) ) uniq_id <- uuid::UUIDgenerate() - deployed <- deploy(test_conn_1, bnd, uniq_id) + deployed <- deploy(client, bnd, uniq_id) rlang::with_options( progress_enabled = FALSE, cl <- content_list_with_permissions( - test_conn_1, + client, .p = ~ .x$guid == deployed$content$guid ) ) @@ -128,14 +128,14 @@ test_that("content_list_guid_has_access works", { ) ) uniq_id <- uuid::UUIDgenerate() - deployed <- deploy(test_conn_1, bnd, uniq_id) + deployed <- deploy(client, bnd, uniq_id) rlang::with_options( progress_enabled = FALSE, - cl <- content_list_with_permissions(test_conn_1) + cl <- content_list_with_permissions(client) ) - my_guid <- test_conn_1$me()$guid + my_guid <- client$me()$guid filt <- content_list_guid_has_access(cl, my_guid) expect_true("permission" %in% names(filt)) expect_true(nrow(filt) <= nrow(cl)) diff --git a/tests/integrated/test-git.R b/tests/integrated/test-git.R index 6ac02b465..28171fe8d 100644 --- a/tests/integrated/test-git.R +++ b/tests/integrated/test-git.R @@ -1,4 +1,4 @@ -skip_if_connect_older_than(test_conn_1, "2022.12.0") +skip_if_connect_older_than(client, "2022.12.0") cont1_name <- uuid::UUIDgenerate() cont1_title <- "Test Content 1" @@ -8,7 +8,7 @@ cont1_bundle <- NULL test_that("git deployment works", { scoped_experimental_silence() cont0 <- deploy_repo( - test_conn_1, + client, "https://github.com/posit-dev/connectapi", "main", "tests/testthat/examples/static" @@ -18,7 +18,7 @@ test_that("git deployment works", { new_name <- uuid::UUIDgenerate() cont1 <- deploy_repo( - test_conn_1, + client, "https://github.com/posit-dev/connectapi", "main", "tests/testthat/examples/static", @@ -36,7 +36,7 @@ test_that("git deployment works", { test_that("repo_check_account works", { scoped_experimental_silence() expect_message( - acc <- repo_check_account(test_conn_1, "https://github.com"), + acc <- repo_check_account(client, "https://github.com"), "anonymous" ) @@ -46,12 +46,12 @@ test_that("repo_check_account works", { test_that("repo_check_branches works", { scoped_experimental_silence() expect_message( - expect_error(repo_check_branches(test_conn_1, "https://github.com")), + expect_error(repo_check_branches(client, "https://github.com")), "not found" ) br <- repo_check_branches( - test_conn_1, + client, "https://github.com/posit-dev/connectapi" ) expect_true("main" %in% br) @@ -60,12 +60,12 @@ test_that("repo_check_branches works", { test_that("repo_check_branches_ref works", { scoped_experimental_silence() expect_message( - expect_error(repo_check_branches_ref(test_conn_1, "https://github.com")), + expect_error(repo_check_branches_ref(client, "https://github.com")), "not found" ) br <- repo_check_branches_ref( - test_conn_1, + client, "https://github.com/posit-dev/connectapi" ) expect_type(br, "character") @@ -78,7 +78,7 @@ test_that("repo_check_manifest_dirs works", { scoped_experimental_silence() expect_message( expect_error(repo_check_manifest_dirs( - test_conn_1, + client, "https://github.com", "main" )), @@ -86,7 +86,7 @@ test_that("repo_check_manifest_dirs works", { ) drs <- repo_check_manifest_dirs( - test_conn_1, + client, "https://github.com/posit-dev/connectapi", "main" ) @@ -98,7 +98,7 @@ test_that("deploy_repo_enable works", { new_name <- uuid::UUIDgenerate() cont1 <- deploy_repo( - test_conn_1, + client, "https://github.com/posit-dev/connectapi", "main", "tests/testthat/examples/static", @@ -128,7 +128,7 @@ test_that("deploy_repo_update works", { new_name <- uuid::UUIDgenerate() cont1 <- deploy_repo( - test_conn_1, + client, "https://github.com/posit-dev/connectapi", "main", "tests/testthat/examples/static", @@ -143,7 +143,7 @@ test_that("deploy_repo_update works", { wrong_branch <- uuid::UUIDgenerate() cont2 <- deploy_repo( - test_conn_1, + client, "https://github.com/posit-dev/connectapi", "master-not-a-real-branch", "tests/testthat/examples/static", @@ -161,7 +161,7 @@ test_that("deploy_repo_update works", { "tests/testthat/examples/static/test.png" ) ) - cont3 <- deploy(test_conn_1, bnd, not_git_name) + cont3 <- deploy(client, bnd, not_git_name) expect_error(deploy_repo_update(cont3), "not git-backed content") }) diff --git a/tests/integrated/test-groups.R b/tests/integrated/test-groups.R index 147d096c5..be3d08dcd 100644 --- a/tests/integrated/test-groups.R +++ b/tests/integrated/test-groups.R @@ -2,12 +2,12 @@ user_guid <- NULL group_guid <- NULL test_that("groups_create works", { - ss <- test_conn_1$server_settings() + ss <- client$server_settings() if (ss$authentication$name %in% c("LDAP")) { skip("not implemented for this authentication provider") } groupname <- create_random_name() - res <- test_conn_1$groups_create( + res <- client$groups_create( name = groupname ) @@ -17,29 +17,29 @@ test_that("groups_create works", { }) test_that("groups works", { - groups <- test_conn_1$groups() + groups <- client$groups() expect_gt(length(groups$results), 0) }) test_that("group_member_add works", { - user_guid <<- test_conn_1$users_create( + user_guid <<- client$users_create( username = paste0("group_member", create_random_name()), email = "test@example.com", user_must_set_password = TRUE )$guid - res <- test_conn_1$group_member_add(group_guid, user_guid) + res <- client$group_member_add(group_guid, user_guid) - members <- test_conn_1$group_members(group_guid) + members <- client$group_members(group_guid) expect_true(user_guid %in% purrr::map_chr(members$results, ~ .x$guid)) }) test_that("group_member_remove works", { - res <- test_conn_1$group_member_remove(group_guid, user_guid) + res <- client$group_member_remove(group_guid, user_guid) - members <- test_conn_1$group_members(group_guid) + members <- client$group_members(group_guid) expect_false(user_guid %in% purrr::map_chr(members$results, ~ .x$guid)) }) diff --git a/tests/integrated/test-lazy.R b/tests/integrated/test-lazy.R index 6cd594b9e..8e299df66 100644 --- a/tests/integrated/test-lazy.R +++ b/tests/integrated/test-lazy.R @@ -9,7 +9,7 @@ cont1_content <- NULL bnd_static <- bundle_dir(rprojroot::find_package_root_file( "tests/testthat/examples/static" )) -tmp_content <- deploy(test_conn_1, bnd_static) +tmp_content <- deploy(client, bnd_static) test_that("error on bad 'src' object", { expect_error( @@ -20,12 +20,12 @@ test_that("error on bad 'src' object", { test_that("error on bad 'from' value", { expect_error( - tbl_connect(test_conn_1, "bad_from") + tbl_connect(client, "bad_from") ) }) test_that("users works", { - users <- tbl_connect(test_conn_1, "users") + users <- tbl_connect(client, "users") expect_s3_class(users, c("tbl_connect", "tbl_lazy", "tbl")) users_local <- users %>% dplyr::collect() @@ -42,7 +42,7 @@ test_that("users works", { }) test_that("usage_static works", { - content_visits <- tbl_connect(test_conn_1, "usage_static") + content_visits <- tbl_connect(client, "usage_static") expect_s3_class(content_visits, c("tbl_connect", "tbl_lazy", "tbl")) content_visits_local <- content_visits %>% dplyr::collect() @@ -61,7 +61,7 @@ test_that("usage_static works", { }) test_that("usage_shiny works", { - shiny_usage <- tbl_connect(test_conn_1, "usage_shiny") + shiny_usage <- tbl_connect(client, "usage_shiny") expect_s3_class(shiny_usage, c("tbl_connect", "tbl_lazy", "tbl")) shiny_usage_local <- shiny_usage %>% dplyr::collect() @@ -76,7 +76,7 @@ test_that("usage_shiny works", { test_that("content works", { scoped_experimental_silence() - content_list <- tbl_connect(test_conn_1, "content") + content_list <- tbl_connect(client, "content") expect_s3_class(content_list, c("tbl_connect", "tbl_lazy", "tbl")) content_list_local <- content_list %>% dplyr::collect() @@ -97,7 +97,7 @@ test_that("content works", { test_that("groups works", { scoped_experimental_silence() - groups_list <- tbl_connect(test_conn_1, "groups") + groups_list <- tbl_connect(client, "groups") expect_s3_class(groups_list, c("tbl_connect", "tbl_lazy", "tbl")) groups_list_local <- groups_list %>% dplyr::collect() @@ -112,7 +112,7 @@ test_that("groups works", { test_that("audit_logs works", { scoped_experimental_silence() - audit_list <- tbl_connect(test_conn_1, "audit_logs") + audit_list <- tbl_connect(client, "audit_logs") expect_s3_class(audit_list, c("tbl_connect", "tbl_lazy", "tbl")) audit_list_local <- audit_list %>% dplyr::collect() @@ -123,6 +123,6 @@ test_that("audit_logs works", { expect_gt(length(colnames(audit_list)), 1) # This is different on older versions, not sure it's worth worrying about how - skip_if_connect_older_than(test_conn_1, "2022.09.0") + skip_if_connect_older_than(client, "2022.09.0") expect_ptype_equal(audit_list_local, connectapi_ptypes$audit_logs) }) diff --git a/tests/integrated/test-misc.R b/tests/integrated/test-misc.R index 5351a71e5..c6836db0c 100644 --- a/tests/integrated/test-misc.R +++ b/tests/integrated/test-misc.R @@ -1,19 +1,19 @@ test_that("audit_logs work", { - logs <- test_conn_1$audit_logs() + logs <- client$audit_logs() expect_gt(length(logs$results), 0) - logs2 <- test_conn_1$audit_logs(nxt = logs$paging$cursors$`next`) + logs2 <- client$audit_logs(nxt = logs$paging$cursors$`next`) expect_gt(length(logs2$results), 0) }) test_that("server_settings work", { - ss <- test_conn_1$server_settings() + ss <- client$server_settings() expect_gt(length(ss), 0) }) test_that("server_settings_r work", { - ssr <- test_conn_1$server_settings_r() + ssr <- client$server_settings_r() expect_gt(length(ssr$installations), 0) }) diff --git a/tests/integrated/test-run-as.R b/tests/integrated/test-run-as.R index 3e2a83f4b..9d990a3ed 100644 --- a/tests/integrated/test-run-as.R +++ b/tests/integrated/test-run-as.R @@ -1,9 +1,9 @@ # Temporarily skip these on newer Connect versions because the manifest for this # content specifies an old version of R not found in newer images. -skip_if(safe_server_version(test_conn_1) > "2024.03.0") +skip_if(safe_server_version(client) > "2024.03.0") # ensure that RSPM is being used so these do not take eternity -shiny_content <- deploy_example(test_conn_1, "shiny") +shiny_content <- deploy_example(client, "shiny") test_that("set_run_as works with a good linux user", { scoped_experimental_silence() diff --git a/tests/integrated/test-schedule.R b/tests/integrated/test-schedule.R index 469ee07d0..202ba3a65 100644 --- a/tests/integrated/test-schedule.R +++ b/tests/integrated/test-schedule.R @@ -1,8 +1,8 @@ # Temporarily skip these on newer Connect versions because the manifest for this # content specifies an old version of R not found in newer images. -skip_if(safe_server_version(test_conn_1) > "2024.03.0") +skip_if(safe_server_version(client) > "2024.03.0") -rmd_content <- deploy_example(test_conn_1, "rmarkdown") +rmd_content <- deploy_example(client, "rmarkdown") ## Test Schedule ------------------------------------------------------- @@ -127,7 +127,7 @@ test_that("schedule display works", { skip("need a way to make this less time sensitive (with next run)") scoped_experimental_silence() - tzs <- get_timezones(test_conn_1) + tzs <- get_timezones(client) set_schedule_remove(d_var_sch) tmp <- set_schedule_day( @@ -146,7 +146,7 @@ test_that("get_schedules works", { tmp <- set_schedule_day(d_var_sch, n = 5) expect_true(validate_R6_class(tmp, "Variant")) - res <- test_conn_1$schedules() + res <- client$schedules() expect_gte(length(res), 1) set_schedule_remove(d_var_sch) diff --git a/tests/integrated/test-tags.R b/tests/integrated/test-tags.R index 1a72e067a..d44df0100 100644 --- a/tests/integrated/test-tags.R +++ b/tests/integrated/test-tags.R @@ -24,22 +24,22 @@ check_tag_exists <- function(con, id) { # Tests --------------------------------------- test_that("create tags works", { - parent_tag <<- test_conn_1$tag_create(parent_tag_name) - child_tag <<- test_conn_1$tag_create(child_tag_name, parent_tag$id) + parent_tag <<- client$tag_create(parent_tag_name) + child_tag <<- client$tag_create(child_tag_name, parent_tag$id) expect_identical(parent_tag$name, parent_tag_name) expect_identical(child_tag$name, child_tag_name) expect_identical(child_tag$parent_id, parent_tag$id) # tag_id lookup works - test_conn_1$get_tags(TRUE) - expect_equal(child_tag$id, test_conn_1$get_tag_id(child_tag_name)) + client$get_tags(TRUE) + expect_equal(child_tag$id, client$get_tag_id(child_tag_name)) }) ## Test high level functions -------------------------------------------------- test_that("get_tags works", { - atags <- get_tags(test_conn_1) + atags <- get_tags(client) expect_s3_class(atags, "connect_tag_tree") }) @@ -49,50 +49,50 @@ test_that("create_tag and delete_tag works", { ctag_2 <- uuid::UUIDgenerate(use.time = TRUE) ctag_3 <- uuid::UUIDgenerate(use.time = TRUE) - capture.output(res <- create_tag(test_conn_1, ptag_1)) + capture.output(res <- create_tag(client, ptag_1)) expect_true(validate_R6_class(res, "Connect")) - tags <- get_tags(test_conn_1) - capture.output(create_tag(test_conn_1, ctag_1, tags[[ptag_1]])) + tags <- get_tags(client) + capture.output(create_tag(client, ctag_1, tags[[ptag_1]])) - tags <- get_tags(test_conn_1) - capture.output(create_tag(test_conn_1, ctag_2, tags[[ptag_1]][[ctag_1]])) + tags <- get_tags(client) + capture.output(create_tag(client, ctag_2, tags[[ptag_1]][[ctag_1]])) - tags <- get_tags(test_conn_1) + tags <- get_tags(client) capture.output(create_tag( - test_conn_1, + client, ctag_3, tags[[ptag_1]][[ctag_1]][[ctag_2]] )) - tags <- get_tags(test_conn_1) + tags <- get_tags(client) - delete_tag(test_conn_1, tags[[ptag_1]][[ctag_1]][[ctag_2]][[ctag_3]]) + delete_tag(client, tags[[ptag_1]][[ctag_1]][[ctag_2]][[ctag_3]]) expect_false(check_tag_exists( - test_conn_1, + client, tags[[ptag_1]][[ctag_1]][[ctag_2]][[ctag_3]][["id"]] )) - delete_tag(test_conn_1, tags[[ptag_1]][[ctag_1]][[ctag_2]]) + delete_tag(client, tags[[ptag_1]][[ctag_1]][[ctag_2]]) expect_false(check_tag_exists( - test_conn_1, + client, tags[[ptag_1]][[ctag_1]][[ctag_2]][["id"]] )) - delete_tag(test_conn_1, tags[[ptag_1]][[ctag_1]]) - expect_false(check_tag_exists(test_conn_1, tags[[ptag_1]][[ctag_1]][["id"]])) + delete_tag(client, tags[[ptag_1]][[ctag_1]]) + expect_false(check_tag_exists(client, tags[[ptag_1]][[ctag_1]][["id"]])) - res <- delete_tag(test_conn_1, tags[[ptag_1]]) - expect_false(check_tag_exists(test_conn_1, tags[[ptag_1]][["id"]])) + res <- delete_tag(client, tags[[ptag_1]]) + expect_false(check_tag_exists(client, tags[[ptag_1]][["id"]])) expect_true(validate_R6_class(res, "Connect")) }) test_that("delete_tag errs for whole tree", { - alltags <- get_tags(test_conn_1) + alltags <- get_tags(client) expect_error( - delete_tag(test_conn_1, alltags), + delete_tag(client, alltags), "entire tag tree" ) }) @@ -100,10 +100,10 @@ test_that("delete_tag errs for whole tree", { test_that("con$tag with id returns just one record", { ptag_1 <- uuid::UUIDgenerate(use.time = TRUE) ctag_1 <- uuid::UUIDgenerate(use.time = TRUE) - capture.output(a1 <- create_tag_tree(test_conn_1, ptag_1, ctag_1)) + capture.output(a1 <- create_tag_tree(client, ptag_1, ctag_1)) - tags1 <- get_tags(test_conn_1) - res <- test_conn_1$tag(tags1[[ptag_1]][[ctag_1]][["id"]]) + tags1 <- get_tags(client) + res <- client$tag(tags1[[ptag_1]][[ctag_1]][["id"]]) expect_equal( names(res), c("id", "name", "parent_id", "created_time", "updated_time") @@ -116,23 +116,23 @@ test_that("create_tag_tree works", { ctag_2 <- uuid::UUIDgenerate(use.time = TRUE) ctag_3 <- uuid::UUIDgenerate(use.time = TRUE) - capture.output(a1 <- create_tag_tree(test_conn_1, ptag_1, ctag_1)) + capture.output(a1 <- create_tag_tree(client, ptag_1, ctag_1)) expect_true(validate_R6_class(a1, "Connect")) - tags1 <- get_tags(test_conn_1) + tags1 <- get_tags(client) capture.output( - a2 <- create_tag_tree(test_conn_1, ptag_1, ctag_1, ctag_2, ctag_3) + a2 <- create_tag_tree(client, ptag_1, ctag_1, ctag_2, ctag_3) ) expect_true(validate_R6_class(a2, "Connect")) - tags2 <- get_tags(test_conn_1) + tags2 <- get_tags(client) expect_identical(tags1[[ptag_1]][["id"]], tags2[[ptag_1]][["id"]]) - delete_tag(test_conn_1, tags2[[ptag_1]]) + delete_tag(client, tags2[[ptag_1]]) expect_error( - suppressMessages(test_conn_1$tag(tags2[[ptag_1]][["id"]])), + suppressMessages(client$tag(tags2[[ptag_1]][["id"]])), "Not Found" ) }) @@ -145,7 +145,7 @@ test_that("get_content_tags and set_content_tags works", { ctag_2_1 <- uuid::UUIDgenerate(use.time = TRUE) app1 <- deploy( - test_conn_1, + client, bundle_dir(rprojroot::find_package_root_file( "tests", "testthat", @@ -155,9 +155,9 @@ test_that("get_content_tags and set_content_tags works", { ) capture.output( - tmp1 <- create_tag_tree(test_conn_1, ptag_1, ctag_1_1, ctag_1_2) + tmp1 <- create_tag_tree(client, ptag_1, ctag_1_1, ctag_1_2) ) - capture.output(tmp2 <- create_tag_tree(test_conn_1, ptag_1, ctag_2_1)) + capture.output(tmp2 <- create_tag_tree(client, ptag_1, ctag_2_1)) expect_true(validate_R6_class(tmp1, "Connect")) expect_true(validate_R6_class(tmp2, "Connect")) @@ -165,7 +165,7 @@ test_that("get_content_tags and set_content_tags works", { ct <- get_content_tags(app1) expect_length(ct, 0) - all_tags <- get_tags(test_conn_1) + all_tags <- get_tags(client) c1o <- capture.output( c1 <- set_content_tags( @@ -198,7 +198,7 @@ test_that("set_content_tag_tree works", { ctag_2_1 <- uuid::UUIDgenerate(use.time = TRUE) app1 <- deploy( - test_conn_1, + client, bundle_dir(rprojroot::find_package_root_file( "tests", "testthat", @@ -208,9 +208,9 @@ test_that("set_content_tag_tree works", { ) capture.output( - tmp1 <- create_tag_tree(test_conn_1, ptag_1, ctag_1_1, ctag_1_2) + tmp1 <- create_tag_tree(client, ptag_1, ctag_1_1, ctag_1_2) ) - capture.output(tmp2 <- create_tag_tree(test_conn_1, ptag_1, ctag_2_1)) + capture.output(tmp2 <- create_tag_tree(client, ptag_1, ctag_2_1)) expect_true(validate_R6_class(tmp1, "Connect")) expect_true(validate_R6_class(tmp2, "Connect")) diff --git a/tests/integrated/test-users.R b/tests/integrated/test-users.R index eb96d0564..4d0b8538a 100644 --- a/tests/integrated/test-users.R +++ b/tests/integrated/test-users.R @@ -1,11 +1,11 @@ test_that("users_create works", { - ss <- test_conn_1$server_settings() + ss <- client$server_settings() if (ss$authentication$name %in% c("LDAP")) { skip("not implemented for this authentication provider") } username <- create_random_name() password <- uuid::UUIDgenerate(use.time = TRUE) - res <- test_conn_1$users_create( + res <- client$users_create( username = username, first_name = "Test", last_name = "User", @@ -18,42 +18,42 @@ test_that("users_create works", { }) test_that("users works", { - users <- test_conn_1$users() + users <- client$users() expect_gt(length(users$results), 0) }) test_that("user_guid_from_username works", { expect_error( - user_guid_from_username(test_conn_1, "this-user-prefix-does-not-exist"), + user_guid_from_username(client, "this-user-prefix-does-not-exist"), "user not found" ) user_username <- create_random_name(20) - user_res <- test_conn_1$users_create( + user_res <- client$users_create( user_username, "example@example.com", password = user_username ) user_username_2 <- paste0(user_username, "X") - user_res_2 <- test_conn_1$users_create( + user_res_2 <- client$users_create( user_username_2, "example@example.com", password = user_username_2 ) expect_warning( - user_guid_from_username(test_conn_1, substr(user_username, 0, 19)), + user_guid_from_username(client, substr(user_username, 0, 19)), "multiple users found" ) expect_equal( - user_guid_from_username(test_conn_1, user_username), + user_guid_from_username(client, user_username), user_res$guid ) expect_equal( - user_guid_from_username(test_conn_1, user_username_2), + user_guid_from_username(client, user_username_2), user_res_2$guid ) }) diff --git a/tests/integrated/test-variant.R b/tests/integrated/test-variant.R index cbdde8719..ca8c1d355 100644 --- a/tests/integrated/test-variant.R +++ b/tests/integrated/test-variant.R @@ -1,9 +1,9 @@ # Temporarily skip these on newer Connect versions because the manifest for this # content specifies an old version of R not found in newer images. -skip_if(safe_server_version(test_conn_1) > "2024.03.0") +skip_if(safe_server_version(client) > "2024.03.0") # ensure that RSPM is being used so these do not take eternity -rmd_content <- deploy_example(test_conn_1, "rmarkdown") +rmd_content <- deploy_example(client, "rmarkdown") # TODO: very hard to test parameterized rmarkdown because creating a # programmatic variant is not possible diff --git a/tests/test-integrated.R b/tests/test-integrated.R index 7c6740b5d..1f530e8fa 100644 --- a/tests/test-integrated.R +++ b/tests/test-integrated.R @@ -4,7 +4,7 @@ library(connectapi) if (nzchar(Sys.getenv("CONNECTAPI_INTEGRATED"))) { # Make sure one server is up tryCatch( - httr::content(httr::GET(paste0(Sys.getenv("TEST_1_SERVER"), "/__ping__"))), + httr::content(httr::GET(paste0(Sys.getenv("CONNECT_SERVER"), "/__ping__"))), error = function(e) { stop("Server 1 is not healthy") } diff --git a/vignettes/articles/connectapi_tags.Rmd b/vignettes/articles/connectapi_tags.Rmd index d57f21d7c..e0a3d48f2 100644 --- a/vignettes/articles/connectapi_tags.Rmd +++ b/vignettes/articles/connectapi_tags.Rmd @@ -8,7 +8,7 @@ output: html_document ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) library(connectapi) -client <- connect(prefix = "TEST_1") +client <- connect() options("connectapi_disable_experimental_warnings" = TRUE) ``` diff --git a/vignettes/articles/content_permissions.Rmd b/vignettes/articles/content_permissions.Rmd index c37a6a005..56ca4f3fb 100644 --- a/vignettes/articles/content_permissions.Rmd +++ b/vignettes/articles/content_permissions.Rmd @@ -8,7 +8,7 @@ output: html_document ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) library(connectapi) -client <- connect(prefix = "TEST_1") +client <- connect() options("connectapi_disable_experimental_warnings" = TRUE) ``` From 925a558c8b2bcad3844ca916805ab207c8063dd8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 28 Oct 2025 12:45:36 +0000 Subject: [PATCH 3/7] Update documentation --- man/bundle_dir.Rd | 2 +- man/bundle_path.Rd | 2 +- man/bundle_static.Rd | 2 +- man/connect.Rd | 2 +- man/deploy.Rd | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/man/bundle_dir.Rd b/man/bundle_dir.Rd index 272fd84a5..47d7c865a 100644 --- a/man/bundle_dir.Rd +++ b/man/bundle_dir.Rd @@ -21,7 +21,7 @@ Bundle A bundle object Creates a bundle from a target directory. } \examples{ -\dontshow{if (identical(Sys.getenv("IN_PKGDOWN"), "true")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (identical(Sys.getenv("IN_PKGDOWN"), "true")) withAutoprint(\{ # examplesIf} bundle_dir(system.file("tests/testthat/examples/shiny/", package = "connectapi")) \dontshow{\}) # examplesIf} diff --git a/man/bundle_path.Rd b/man/bundle_path.Rd index 7eff4f3c4..586e0d119 100644 --- a/man/bundle_path.Rd +++ b/man/bundle_path.Rd @@ -16,7 +16,7 @@ Bundle A bundle object Define a bundle from a path (a path directly to a tar.gz file) } \examples{ -\dontshow{if (identical(Sys.getenv("IN_PKGDOWN"), "true")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (identical(Sys.getenv("IN_PKGDOWN"), "true")) withAutoprint(\{ # examplesIf} bundle_path(system.file("tests/testthat/examples/static.tar.gz", package = "connectapi")) \dontshow{\}) # examplesIf} diff --git a/man/bundle_static.Rd b/man/bundle_static.Rd index bc855f147..0a7559598 100644 --- a/man/bundle_static.Rd +++ b/man/bundle_static.Rd @@ -26,7 +26,7 @@ directory, generates a basic manifest file (using the first file as the NOTE: the \code{rsconnect} package is required for this function to work properly. } \examples{ -\dontshow{if (identical(Sys.getenv("IN_PKGDOWN"), "true")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (identical(Sys.getenv("IN_PKGDOWN"), "true")) withAutoprint(\{ # examplesIf} bundle_static(system.file("logo.png", package = "connectapi")) \dontshow{\}) # examplesIf} diff --git a/man/connect.Rd b/man/connect.Rd index ce0e2bd47..696ba7abb 100644 --- a/man/connect.Rd +++ b/man/connect.Rd @@ -72,7 +72,7 @@ fallback_key <- Sys.getenv("VIEWER_ROLE_API_KEY") client <- connect(token = token, token_local_testing_key = fallback_key) } -\dontshow{if (identical(Sys.getenv("IN_PKGDOWN"), "true")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (identical(Sys.getenv("IN_PKGDOWN"), "true")) withAutoprint(\{ # examplesIf} # default is to read CONNECT_SERVER and CONNECT_API_KEY environment variables connect() diff --git a/man/deploy.Rd b/man/deploy.Rd index 5630b561a..977e992e3 100644 --- a/man/deploy.Rd +++ b/man/deploy.Rd @@ -60,7 +60,7 @@ bnd <- bundle_dir(".") deploy(client, bnd) } -\dontshow{if (identical(Sys.getenv("IN_PKGDOWN"), "true")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (identical(Sys.getenv("IN_PKGDOWN"), "true")) withAutoprint(\{ # examplesIf} client <- connect() bnd <- bundle_path(system.file("tests/testthat/examples/static.tar.gz", package = "connectapi")) From f141e24ac642d9b45d89bfa311186514b9849cee Mon Sep 17 00:00:00 2001 From: Neal Richardson Date: Tue, 28 Oct 2025 08:46:05 -0400 Subject: [PATCH 4/7] Add explicit server to test --- tests/testthat/test-connect.R | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/testthat/test-connect.R b/tests/testthat/test-connect.R index e18604f7b..972dc6530 100644 --- a/tests/testthat/test-connect.R +++ b/tests/testthat/test-connect.R @@ -52,6 +52,7 @@ test_that("connect() just warns on empty API key if .check_is_fatal=FALSE", { without_internet({ expect_message( client <- connect( + server = "http://posit.co", api_key = "", .check_is_fatal = FALSE ), From 5b9feb581303bf24f7a80b355fe95a1d77762803 Mon Sep 17 00:00:00 2001 From: Neal Richardson Date: Wed, 29 Oct 2025 13:56:32 -0400 Subject: [PATCH 5/7] Add news (and test dev version of with-connect action) --- .github/workflows/integration-tests.yaml | 2 +- NEWS.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/integration-tests.yaml b/.github/workflows/integration-tests.yaml index df14feaca..9b6853641 100644 --- a/.github/workflows/integration-tests.yaml +++ b/.github/workflows/integration-tests.yaml @@ -47,7 +47,7 @@ jobs: shell: Rscript {0} - name: Run integration tests - uses: nealrichardson/with-connect@dev + uses: posit-dev/with-connect@uv-tool env: CONNECTAPI_INTEGRATED: "true" with: diff --git a/NEWS.md b/NEWS.md index e4ebb3786..1c5e8b048 100644 --- a/NEWS.md +++ b/NEWS.md @@ -15,6 +15,7 @@ - New `lock_content()` and `unlock_content()` functions for locking and unlocking content items. (#453) - Updated git-backed deployment functions to use v1 APIs (#459) +- Removed `prefix` argument to `connect()` function, which was a convenience utility for testing. (#477) # connectapi 0.8.0 From 8b129cceab25bc67eec0a3e0da9e451b65b94d8f Mon Sep 17 00:00:00 2001 From: Neal Richardson Date: Wed, 29 Oct 2025 13:58:28 -0400 Subject: [PATCH 6/7] Update other workflows too --- .github/workflows/pkgdown.yaml | 2 +- .github/workflows/test-coverage.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index 0117a5bf9..0f7232639 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -34,7 +34,7 @@ jobs: needs: website - name: Build site - uses: nealrichardson/with-connect@dev + uses: posit-dev/with-connect@main with: # Runs on the default version in the with-connect action license: ${{ secrets.CONNECT_LICENSE_FILE }} diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index d9b06c4bc..d3d30435d 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -29,7 +29,7 @@ jobs: needs: coverage - name: Run coverage - uses: nealrichardson/with-connect@dev + uses: posit-dev/with-connect@main env: CONNECTAPI_INTEGRATED: "true" with: From 99713556f1acfb630d4a6ed2081e91985cd8dec6 Mon Sep 17 00:00:00 2001 From: Neal Richardson Date: Wed, 29 Oct 2025 14:00:29 -0400 Subject: [PATCH 7/7] Clean up TODOs and use main action --- .github/workflows/integration-tests.yaml | 2 +- .github/workflows/pkgdown.yaml | 1 - .github/workflows/test-coverage.yaml | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/integration-tests.yaml b/.github/workflows/integration-tests.yaml index 9b6853641..c7b35f051 100644 --- a/.github/workflows/integration-tests.yaml +++ b/.github/workflows/integration-tests.yaml @@ -47,7 +47,7 @@ jobs: shell: Rscript {0} - name: Run integration tests - uses: posit-dev/with-connect@uv-tool + uses: posit-dev/with-connect@main env: CONNECTAPI_INTEGRATED: "true" with: diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index 0f7232639..4a27cd8d2 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -38,7 +38,6 @@ jobs: with: # Runs on the default version in the with-connect action license: ${{ secrets.CONNECT_LICENSE_FILE }} - # TODO: rewrite tests to use CONNECT_* env vars directly command: | Rscript -e 'pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)' diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index d3d30435d..75ee511b1 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -35,7 +35,6 @@ jobs: with: # Runs on the default version in the with-connect action license: ${{ secrets.CONNECT_LICENSE_FILE }} - # TODO: rewrite tests to use CONNECT_* env vars directly command: | Rscript -e ' covr::codecov(