diff --git a/inst/misc/example.credentials b/inst/misc/example.credentials index de117fea..967fed54 100644 --- a/inst/misc/example.credentials +++ b/inst/misc/example.credentials @@ -35,3 +35,4 @@ redcap_uri,username,project_id,token,comment "https://bbmc.ouhsc.edu/redcap/api/","myusername","3003","1F2EC7059AC339DFDCD5800225DC7A95","blank-for-gray-status" "https://bbmc.ouhsc.edu/redcap/api/","myusername","3074","5007DC786DBE39CE77ED8DD0C68069A6","checkboxes-1" "https://bbmc.ouhsc.edu/redcap/api/","myusername","3181","22C3FF1C8B08899FB6F86D91D874A159","vignette-repeating" +"https://bbmc.ouhsc.edu/redcap/api/","myusername","5002","2DEF128C3F55DA719835FEB506FAC2E9","file-repo" diff --git a/inst/misc/project-redirection.yml b/inst/misc/project-redirection.yml index 1723ecf0..573e2368 100644 --- a/inst/misc/project-redirection.yml +++ b/inst/misc/project-redirection.yml @@ -32,7 +32,7 @@ - blank-for-gray-status: 3003 - checkboxes-1: 3074 - vignette-repeating: 3181 - # - file-repo: 63 + - file-repo: 5002 - instance: dev-2 credential_file: "misc/dev-2.credentials" diff --git a/inst/test-data/projects/file-repo/README.md b/inst/test-data/projects/file-repo/README.md new file mode 100644 index 00000000..59147dfa --- /dev/null +++ b/inst/test-data/projects/file-repo/README.md @@ -0,0 +1,16 @@ +file-repo Test Project +========= + +Steps to Recreate: + +1. Create new project, based on project.xml +1. Reconstruct the file repository, manually + 1. Create top-level directory called "the-state" + 1. Drop [levon-and-barry.jpg](../../levon-and-barry.jpg) into this directory + 1. Navigate back to the root directory. + 1. Drop the following file files into the root directory: + 1. [mugshot-1.jpg](../../mugshot-1.jpg) + 1. [mugshot-2.jpg](../../mugshot-2.jpg) + 1. [mugshot-3.jpg](../../mugshot-3.jpg) + 1. [mugshot-4.jpg](../../mugshot-4.jpg) + 1. [mugshot-5.jpg](../../mugshot-5.jpg) diff --git a/tests/testthat/test-file-repo-list-oneshot.R b/tests/testthat/test-file-repo-list-oneshot.R index 6fed6707..cc96eb91 100644 --- a/tests/testthat/test-file-repo-list-oneshot.R +++ b/tests/testthat/test-file-repo-list-oneshot.R @@ -63,6 +63,11 @@ test_that("default", { }) test_that("first-subdirectory", { testthat::skip_on_cran() + + if (credential$redcap_uri != "https://redcap-dev-2.ouhsc.edu/redcap/api/") { + testthat::skip("The `folder_id` will be different on different servers.") + } + expected_message <- "The file repository structure describing 1 elements was read from REDCap in [0-9.]+ seconds\\. The http status code was 200\\." path_expected <- "test-data/specific-redcapr/file-repo-list-oneshot/first-subdirectory.R" @@ -83,9 +88,7 @@ test_that("first-subdirectory", { expected_data_frame <- retrieve_expected(path_expected) #Test the values of the returned object. - if (credential$redcap_uri == "https://redcap-dev-2.ouhsc.edu/redcap/api/") { - expect_equal(returned_object$data, expected=expected_data_frame, label="The returned data.frame should be correct", ignore_attr = TRUE) # dput(returned_object$data) - } + expect_equal(returned_object$data, expected=expected_data_frame, label="The returned data.frame should be correct", ignore_attr = TRUE) # dput(returned_object$data) expect_equal(nrow(returned_object$data), expected=1L) expect_equal(returned_object$data$name, expected_data_frame$name)