Skip to content

Commit

Permalink
adapt for other servers
Browse files Browse the repository at this point in the history
ref #549
  • Loading branch information
wibeasley committed Nov 3, 2024
1 parent 5539433 commit 9f78f19
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
1 change: 1 addition & 0 deletions inst/misc/example.credentials
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion inst/misc/project-redirection.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
16 changes: 16 additions & 0 deletions inst/test-data/projects/file-repo/README.md
Original file line number Diff line number Diff line change
@@ -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)
9 changes: 6 additions & 3 deletions tests/testthat/test-file-repo-list-oneshot.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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)
Expand Down

0 comments on commit 9f78f19

Please sign in to comment.