From 5ab68309c5ab1c54bd9c0045191e9fe46450259b Mon Sep 17 00:00:00 2001 From: Will Beasley Date: Thu, 7 Nov 2024 12:24:51 -0600 Subject: [PATCH 1/3] small change to trigger GitHub Actions to use curl 6.0.0 ref #554 --- utility/refresh.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utility/refresh.R b/utility/refresh.R index 6b8f56aa..12881278 100644 --- a/utility/refresh.R +++ b/utility/refresh.R @@ -42,7 +42,7 @@ devtools::run_examples(); #dev.off() #This overwrites the NAMESPACE file too # devtools::run_examples(, "redcap_read.Rd") # pkgload::load_all() test_results_checked <- devtools::test() -test_results_checked <- devtools::test(filter = "^retrieve-credential") +test_results_checked <- devtools::test(filter = "^sanitize") # withr::local_envvar(ONLYREADTESTS = "true") # test_results_checked <- devtools::test(filter = "write-batch") From 915249fa3aff3c63e8ad379bccbda9cd21f121a1 Mon Sep 17 00:00:00 2001 From: Will Beasley Date: Fri, 8 Nov 2024 12:56:12 -0600 Subject: [PATCH 2/3] set default server for plugins ref #552 --- R/helpers-testing.R | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/R/helpers-testing.R b/R/helpers-testing.R index 8610fe0c..b3bc7c52 100644 --- a/R/helpers-testing.R +++ b/R/helpers-testing.R @@ -64,11 +64,12 @@ retrieve_plugins <- function(plugin_name) { checkmate::assert_character(plugin_name , any.missing = FALSE, min.chars = 2, max.chars = 50) server_instance <- - # if(Sys.getenv("redcapr_test_server") != "") { + if(Sys.getenv("redcapr_test_server") != "") { Sys.getenv("redcapr_test_server") - # } else { - # "dev-2" - # } + } else { + message("The test server was not explicitly set for plugins, so defaulting to 'dev-2'.") + "dev-2" + } checkmate::assert_character(server_instance , any.missing = FALSE, min.chars = 2, max.chars = 50) # This line avoids a warning from the package check. From c12f65ca9abe0aab45a692cf469cf6a509cfedd9 Mon Sep 17 00:00:00 2001 From: Will Beasley Date: Wed, 20 Nov 2024 20:01:38 -0600 Subject: [PATCH 3/3] don't expect error something in curl must have changed? The bad url is still not sucessful (which is good). But now it's reflectedin a 403 http code, instead of an R error. --- tests/testthat/test-event-instruments.R | 12 ++++++++---- tests/testthat/test-instruments-metadata.R | 11 +++++++---- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/tests/testthat/test-event-instruments.R b/tests/testthat/test-event-instruments.R index 50a50829..6554d610 100644 --- a/tests/testthat/test-event-instruments.R +++ b/tests/testthat/test-event-instruments.R @@ -123,20 +123,24 @@ test_that("2-arms-retrieve-only-arm-2", { test_that("Bad URI", { testthat::skip_on_cran() bad_uri <- "https://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.com" - expected_data_frame <- structure(list(), .Names = character(0), row.names = integer(0), class = "data.frame") + # expected_data_frame <- structure(list(), .Names = character(0), row.names = integer(0), class = "data.frame") # Windows gives a different message than Travis/Linux - expected_outcome_message <- "(https://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.com|Couldn't resolve host 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.com')" + # expected_outcome_message <- "(https://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.com|Couldn't resolve host 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.com')" # "The REDCapR variable retrieval was not successful\\..+?Error 405 \\(Method Not Allowed\\).+" # expected_outcome_message <- "(?s)The REDCapR variable retrieval was not successful\\..+?.+" - expect_error( + # expect_error( returned_object <- redcap_event_instruments( redcap_uri = bad_uri, token = credential_longitudinal$token, verbose = FALSE ) - ) + # ) + + expect_false(returned_object$success) + expect_equal(returned_object$status_code, 403L) + expect_match(returned_object$outcome_message, "The REDCapR instrument retrieval was not successful.+") }) test_that("no-arms", { testthat::skip_on_cran() diff --git a/tests/testthat/test-instruments-metadata.R b/tests/testthat/test-instruments-metadata.R index f7660198..e3b5c175 100644 --- a/tests/testthat/test-instruments-metadata.R +++ b/tests/testthat/test-instruments-metadata.R @@ -40,21 +40,24 @@ test_that("default", { test_that("Bad URI", { testthat::skip_on_cran() bad_uri <- "https://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.com" - expected_data_frame <- structure(list(), .Names = character(0), row.names = integer(0), class = "data.frame") + # expected_data_frame <- structure(list(), .Names = character(0), row.names = integer(0), class = "data.frame") # Windows gives a different message than Travis/Linux - expected_outcome_message <- "(https://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.com|Couldn't resolve host 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.com')" + # expected_outcome_message <- "(https://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.com|Couldn't resolve host 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.com')" # "The REDCapR variable retrieval was not successful\\..+?Error 405 \\(Method Not Allowed\\).+" # expected_outcome_message <- "(?s)The REDCapR variable retrieval was not successful\\..+?.+" - expect_error( + # expect_error( returned_object <- redcap_instruments( redcap_uri = bad_uri, token = credential$token, verbose = FALSE ) - ) + # ) + expect_false(returned_object$success) + expect_equal(returned_object$status_code, 403L) + expect_match(returned_object$outcome_message, "The REDCapR instrument retrieval was not successful.+") }) test_that("bad token -Error", {