-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
closes #186
- Loading branch information
Showing
6 changed files
with
180 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -400,7 +400,6 @@ test_that("All Records -label", { | |
expect_true(returned_object2$fields_collapsed=="", "A subset of fields was not requested.") | ||
expect_match(returned_object2$outcome_messages, regexp=expected_outcome_message, perl=TRUE) | ||
}) | ||
|
||
test_that("All Records -label header", { | ||
testthat::skip_on_cran() | ||
expected_data_frame <- structure(list(`Study ID` = c(1, 2, 3, 4, 5), `First Name` = c("Nutmeg", | ||
|
@@ -488,6 +487,75 @@ test_that("All Records -label header", { | |
expect_match(returned_object$outcome_message, regexp=expected_outcome_message, perl=TRUE) | ||
expect_true(returned_object$success) | ||
}) | ||
test_that("All Records -export_checkbox_label", { | ||
testthat::skip_on_cran() | ||
expected_data_frame <- structure( | ||
list(record_id = c(1, 2, 3, 4, 5), name_first = c("Nutmeg", | ||
"Tumtum", "Marcus", "Trudy", "John Lee"), name_last = c("Nutmouse", | ||
"Nutmouse", "Wood", "DAG", "Walker"), address = c("14 Rose Cottage St.\nKenning UK, 323232", | ||
"14 Rose Cottage Blvd.\nKenning UK 34243", "243 Hill St.\nGuthrie OK 73402", | ||
"342 Elm\nDuncanville TX, 75116", "Hotel Suite\nNew Orleans LA, 70115" | ||
), telephone = c("(405) 321-1111", "(405) 321-2222", "(405) 321-3333", | ||
"(405) 321-4444", "(405) 321-5555"), email = c("[email protected]", | ||
"[email protected]", "[email protected]", "[email protected]", "[email protected]" | ||
), dob = structure(c(12294, 12121, -13051, -6269, -5375), class = "Date"), | ||
age = c(11, 11, 80, 61, 59), sex = c("Female", "Male", "Male", | ||
"Female", "Male"), demographics_complete = c("Complete", | ||
"Complete", "Complete", "Complete", "Complete"), height = c(7, | ||
6, 180, 165, 193.04), weight = c(1, 1, 80, 54, 104), bmi = c(204.1, | ||
277.8, 24.7, 19.8, 27.9), comments = c("Character in a book, with some guessing", | ||
"A mouse character from a good book", "completely made up", | ||
"This record doesn't have a DAG assigned\n\nSo call up Trudy on the telephone\nSend her a letter in the mail", | ||
"Had a hand for trouble and a eye for cash\n\nHe had a gold watch chain and a black mustache" | ||
), mugshot = c("[document]", "[document]", "[document]", | ||
"[document]", "[document]"), health_complete = c("Unverified", | ||
"Incomplete", "Complete", "Complete", "Incomplete"), race___1 = c(NA, | ||
NA, NA, NA, "American Indian/Alaska Native"), race___2 = c(NA, | ||
NA, NA, "Asian", NA), race___3 = c(NA, "Native Hawaiian or Other Pacific Islander", | ||
NA, NA, NA), race___4 = c(NA, NA, "Black or African American", | ||
NA, NA), race___5 = c("White", "White", "White", "White", | ||
NA), race___6 = c(NA, NA, NA, NA, "Unknown / Not Reported" | ||
), ethnicity = c("NOT Hispanic or Latino", "NOT Hispanic or Latino", | ||
"Unknown / Not Reported", "NOT Hispanic or Latino", "Hispanic or Latino" | ||
), race_and_ethnicity_complete = c("Complete", "Incomplete", | ||
"Complete", "Complete", "Complete")), .Names = c("record_id", | ||
"name_first", "name_last", "address", "telephone", "email", "dob", | ||
"age", "sex", "demographics_complete", "height", "weight", "bmi", | ||
"comments", "mugshot", "health_complete", "race___1", "race___2", | ||
"race___3", "race___4", "race___5", "race___6", "ethnicity", | ||
"race_and_ethnicity_complete"), row.names = c(NA, -5L), class = "data.frame" | ||
) | ||
expected_outcome_message <- "\\d+ records and 24 columns were read from REDCap in \\d+(\\.\\d+\\W|\\W)seconds\\." | ||
|
||
########################### | ||
## Default Batch size | ||
expect_message( | ||
regexp = expected_outcome_message, | ||
returned_object1 <- redcap_read(redcap_uri=credential$redcap_uri, token=credential$token, raw_or_label="label", export_checkbox_label=T, verbose=T) | ||
) | ||
expect_equal(returned_object1$data, expected=expected_data_frame, label="The returned data.frame should be correct") # dput(returned_object1$data) | ||
expect_true(returned_object1$success) | ||
expect_match(returned_object1$status_codes, regexp="200", perl=TRUE) | ||
expect_true(returned_object1$records_collapsed=="", "A subset of records was not requested.") | ||
expect_true(returned_object1$fields_collapsed=="", "A subset of fields was not requested.") | ||
expect_true(returned_object1$filter_logic=="", "A filter was not specified.") | ||
expect_match(returned_object1$outcome_messages, regexp=expected_outcome_message, perl=TRUE) | ||
|
||
########################### | ||
## Tiny Batch size | ||
expect_message( | ||
regexp = expected_outcome_message, | ||
returned_object2 <- redcap_read(redcap_uri=credential$redcap_uri, token=credential$token, raw_or_label="label", export_checkbox_label=T, verbose=T, batch_size=2) | ||
) | ||
|
||
expect_equal(returned_object2$data, expected=expected_data_frame, label="The returned data.frame should be correct") # dput(returned_object2$data) | ||
expect_true(returned_object2$success) | ||
expect_match(returned_object2$status_codes, regexp="200", perl=TRUE) | ||
expect_true(returned_object2$records_collapsed=="", "A subset of records was not requested.") | ||
expect_true(returned_object2$fields_collapsed=="", "A subset of fields was not requested.") | ||
expect_match(returned_object2$outcome_messages, regexp=expected_outcome_message, perl=TRUE) | ||
}) | ||
|
||
|
||
test_that("Filter - numeric", { | ||
testthat::skip_on_cran() | ||
|
Oops, something went wrong.