Skip to content

Commit

Permalink
more portable tests
Browse files Browse the repository at this point in the history
ref #542
  • Loading branch information
wibeasley committed Oct 13, 2024
1 parent 6ee7b67 commit 012b003
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
5 changes: 4 additions & 1 deletion inst/test-data/projects/super-wide-3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ The project.xml file is too large to include in an R package (500Kb compressed,
So perform these manual steps to create the project on a new server.

1. Create blank project
1. Create user role "api" with API import & export privileges
1. Create user role "api" with privileges
1. API import
1. API export
1. Data Access Groups
1. Add user "unittestphifree" to role
1. Create token
1. Run <generate-project.R> to
Expand Down
18 changes: 12 additions & 6 deletions tests/testthat/test-dag-read.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,37 @@ test_that("smoke", {
test_that("dag-default", {
testthat::skip_on_cran()
expected_data <-
structure(list(data_access_group_name = c("dag_1", "dag_2"),
unique_group_name = c("dag_1", "dag_2"), data_access_group_id = c(36,
37)), row.names = c(NA, -2L), spec = structure(list(cols = list(
data_access_group_name = structure(list(), class = c("collector_character",
structure(
list(data_access_group_name = c("dag_1", "dag_2"),
unique_group_name = c("dag_1", "dag_2")), row.names = c(NA,
-2L), spec = structure(list(cols = list(data_access_group_name = structure(list(), class = c("collector_character",
"collector")), unique_group_name = structure(list(), class = c("collector_character",
"collector")), data_access_group_id = structure(list(), class = c("collector_double",
"collector"))), default = structure(list(), class = c("collector_guess",
"collector")), delim = ","), class = "col_spec"), class = c("spec_tbl_df",
"tbl_df", "tbl", "data.frame")
)
# dput(actual$data)

actual <-
redcap_dag_read(
redcap_uri = credential_1$redcap_uri,
token = credential_1$token,
verbose = FALSE
)

expect_true(all(!is.na(actual$data$data_access_group_id)))
expect_true(all(0 < actual$data$data_access_group_id))

actual$data$data_access_group_id <- NULL
# dput(actual$data)

expect_true( actual$success)
expect_equal(actual$status_code, 200L)
expect_equal(actual$data, expected_data)
expect_s3_class(actual$data, "tbl")
})

test_that("dag-default", {
test_that("no-dag-default", {
testthat::skip_on_cran()
expected_data <-
structure(
Expand Down

0 comments on commit 012b003

Please sign in to comment.