Skip to content

Commit

Permalink
skip more tests on cran
Browse files Browse the repository at this point in the history
ref #352
  • Loading branch information
wibeasley committed Sep 23, 2021
1 parent a86310f commit 4764d3f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions tests/testthat/test-read-errors.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ library(testthat)
credential <- retrieve_credential_testing()

test_that("One Shot: Bad Uri -Not HTTPS", {
testthat::skip_on_cran()
expected_message_411 <- "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"\"http://www.w3.org/TR/html4/strict.dtd\">\n<HTML><HEAD><TITLE>Length Required</TITLE>\n<META HTTP-EQUIV=\"Content-Type\" Content=\"text/html; charset=us-ascii\"></HEAD>\n<BODY><h2>Length Required</h2>\n<hr><p>HTTP Error 411. The request must be chunked or have a content length.</p>\n</BODY></HTML>\n"
expected_message_501 <- "<?xml version=\"1.0\" encoding=\"UTF-8\" ?><hash><error>The requested method is not implemented.</error></hash>"

Expand All @@ -24,6 +25,7 @@ test_that("One Shot: Bad Uri -Not HTTPS", {
})

test_that("One Shot: Bad Uri -wrong address", {
testthat::skip_on_cran()
expected_message <- "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"/>\n<title>404 - File or directory not found.</title>\n<style type=\"text/css\">\n<!--\nbody{margin:0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;}\nfieldset{padding:0 15px 10px 15px;} \nh1{font-size:2.4em;margin:0;color:#FFF;}\nh2{font-size:1.7em;margin:0;color:#CC0000;} \nh3{font-size:1.2em;margin:10px 0 0 0;color:#000000;} \n#header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:\"trebuchet MS\", Verdana, sans-serif;color:#FFF;\nbackground-color:#555555;}\n#content{margin:0 0 0 2%;position:relative;}\n.content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;position:relative;}\n-->\n</style>\n</head>\n<body>\n<div id=\"header\"><h1>Server Error</h1></div>\n<div id=\"content\">\n <div class=\"content-container\"><fieldset>\n <h2>404 - File or directory not found.</h2>\n <h3>The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.</h3>\n </fieldset></div>\n</div>\n</body>\n</html>\n"

expect_message(
Expand All @@ -43,6 +45,7 @@ test_that("One Shot: Bad Uri -wrong address", {
})

test_that("Batch: Bad Uri -Not HTTPS", {
testthat::skip_on_cran()
expected_outcome_message <- "The initial call failed with the code: (411|501)."

expect_message(
Expand All @@ -62,6 +65,7 @@ test_that("Batch: Bad Uri -Not HTTPS", {
})

test_that("Batch: Bad Uri -wrong address", {
testthat::skip_on_cran()
expected_outcome_message <- "The initial call failed with the code: 404."

expect_message(
Expand All @@ -81,6 +85,7 @@ test_that("Batch: Bad Uri -wrong address", {
})

test_that("hashed record -warn", {
testthat::skip_on_cran()
# This dinky little test is mostly to check that the warning message has legal syntax.
expected_warning <- "^It appears that the REDCap record IDs have been hashed.+"

Expand All @@ -91,6 +96,7 @@ test_that("hashed record -warn", {
})

test_that("guess_max deprecated -warn", {
testthat::skip_on_cran()
expected_outcome_message <- "The `guess_max` parameter in `REDCapR::redcap_read\\(\\)` is deprecated\\."

expect_warning(
Expand Down
5 changes: 5 additions & 0 deletions tests/testthat/test-write-error.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ update_expectation <- FALSE


test_that("One Shot: writing with read-only privileges", {
testthat::skip_on_cran()
credential <- retrieve_credential_testing(project_id = 153L) # read-only
# expect_message(
# returned_object1 <- redcap_read_oneshot(redcap_uri=credential$redcap_uri, token=credential$token, raw_or_label="raw")
Expand Down Expand Up @@ -33,6 +34,7 @@ test_that("One Shot: writing with read-only privileges", {


test_that("Single Batch: writing with read-only privileges", {
testthat::skip_on_cran()
credential <- retrieve_credential_testing(project_id = 153L) # read-only

expected_message <- "The REDCapR write/import operation was not successful. The error message was:\nERROR: You do not have API Import/Update privileges"
Expand All @@ -51,6 +53,7 @@ test_that("Single Batch: writing with read-only privileges", {
})

test_that("Many Batches: writing with read-only privileges", {
testthat::skip_on_cran()
credential <- retrieve_credential_testing(project_id = 153L) # read-only

expected_message <- "The REDCapR write/import operation was not successful. The error message was:\nERROR: You do not have API Import/Update privileges"
Expand All @@ -68,6 +71,7 @@ test_that("Many Batches: writing with read-only privileges", {
})

test_that("Single Batch: writing with read-only privileges --contiue on error", {
testthat::skip_on_cran()
credential <- retrieve_credential_testing(project_id = 153L) # read-only

expected_message <- "The REDCapR write/import operation was not successful. The error message was:\nERROR: You do not have API Import/Update privileges"
Expand All @@ -89,6 +93,7 @@ test_that("Single Batch: writing with read-only privileges --contiue on error",
})

test_that("Many Batches: writing with read-only privileges --contiue on error", {
testthat::skip_on_cran()
credential <- retrieve_credential_testing(project_id = 153L) # read-only

expected_message <- "The REDCapR write/import operation was not successful. The error message was:\nERROR: You do not have API Import/Update privileges"
Expand Down
2 changes: 1 addition & 1 deletion utility/refresh.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pkgdown::build_site()
devtools::run_examples(); #dev.off() #This overwrites the NAMESPACE file too
# devtools::run_examples(, "redcap_read.Rd")
test_results_checked <- devtools::test()
test_results_checked <- devtools::test(filter = "read-errors")
test_results_checked <- devtools::test(filter = "write-error")
test_results_checked <- devtools::test(filter = "report")
test_results_checked <- devtools::test(filter = "validate.*$")

Expand Down

0 comments on commit 4764d3f

Please sign in to comment.