Skip to content

Commit 6401f54

Browse files
committed
fix test
1 parent 0a25ff3 commit 6401f54

File tree

3 files changed

+24
-8
lines changed

3 files changed

+24
-8
lines changed

R/utils.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ try_redcapr <- function(expr, call = caller_env()) {
805805
"i" = "URI: `{condition$redcap_uri}`"
806806
)
807807
condition$class <- c("cannot_post", condition$class)
808-
} else if (str_detect(
808+
} else if (!is.null(out$outcome_message) && str_detect(
809809
out$outcome_message,
810810
"You must have 'API Export' privileges and 'Data Access Groups' privileges"
811811
)

utility/cli_message_examples.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,7 @@ read_redcap(Sys.getenv("REDCAP_URI"), Sys.getenv("REDCAPTIDIER_CLASSIC_API")) %>
151151
# missing data codes
152152

153153
read_redcap(redcap_uri, Sys.getenv("REDCAPTIDIER_MDC_API"))
154+
155+
# No DAG export access
156+
157+
read_redcap(Sys.getenv("REDCAP_URI"), Sys.getenv("REDCAPTIDIER_DAG_ACCESS_API"))

utility/cli_message_examples_reprex.md

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ read_redcap(redcap_uri, classic_token, export_survey_fields = 123)
112112

113113
read_redcap(redcap_uri, classic_token, export_survey_fields = c(TRUE, TRUE))
114114
#> Error in `read_redcap()`:
115-
#> ✖ You've supplied `TRUE` and `TRUE` for `export_survey_fields` which is
116-
#> not a valid value
115+
#> ✖ You've supplied `TRUE` `TRUE` for `export_survey_fields` which is not
116+
#> a valid value
117117
#> ! Must have length 1, but has length 2
118118

119119
## suppress_redcapr_messages
@@ -126,8 +126,8 @@ read_redcap(redcap_uri, classic_token, suppress_redcapr_messages = 123)
126126

127127
read_redcap(redcap_uri, classic_token, suppress_redcapr_messages = c(TRUE, TRUE))
128128
#> Error in `read_redcap()`:
129-
#> ✖ You've supplied `TRUE` and `TRUE` for `suppress_redcapr_messages`
130-
#> which is not a valid value
129+
#> ✖ You've supplied `TRUE` `TRUE` for `suppress_redcapr_messages` which is
130+
#> not a valid value
131131
#> ! Must have length 1, but has length 2
132132

133133
# data access groups
@@ -255,7 +255,7 @@ withr::with_tempdir({
255255
})
256256
#> Error:
257257
#> ✖ File
258-
#> ''/private/var/folders/qc/mmjjyjq50530z9r_7mfqcqfhxkkk67/T/Rtmph4LQ3Z/filee5aa7b9bea48/temp.csv''
258+
#> ''/private/var/folders/9c/k1m0bzys7gb1v32g86hfn5sn5k86h1/T/RtmpQCmzPP/file1411b189a9c52/temp.csv''
259259
#> already exists.
260260
#> ℹ Overwriting files is disabled by default. Set `overwrite = TRUE` to overwrite
261261
#> existing file.
@@ -296,7 +296,7 @@ withr::with_tempdir({
296296
write_redcap_xlsx(file = filepath)
297297
})
298298
#> Warning in write_redcap_xlsx(., file = filepath): ! No extension provided for `file`:
299-
#> '/private/var/folders/qc/mmjjyjq50530z9r_7mfqcqfhxkkk67/T/Rtmph4LQ3Z/filee5aa11455c98/temp'
299+
#> '/private/var/folders/9c/k1m0bzys7gb1v32g86hfn5sn5k86h1/T/RtmpQCmzPP/file1411b1319086f/temp'
300300
#> ℹ The extension '.xlsx' will be appended to the file name.
301301

302302
# Printed supertibble
@@ -338,6 +338,18 @@ read_redcap(redcap_uri, Sys.getenv("REDCAPTIDIER_MDC_API"))
338338
#> 1 form_1 Form 1 <tibble [3 × 9]> <tibble> nonrepeat…
339339
#> # ℹ 5 more variables: data_rows <int>, data_cols <int>, data_size <lbstr_by>,
340340
#> # data_na_pct <formttbl>, form_complete_pct <formttbl>
341+
342+
# No DAG export access
343+
344+
read_redcap(Sys.getenv("REDCAP_URI"), Sys.getenv("REDCAPTIDIER_DAG_ACCESS_API"))
345+
#> Error in `read_redcap()`:
346+
#> ✖ The REDCapR export operation was not successful.
347+
#> ! You do not have sufficient privileges to export data access groups.
348+
#> ℹ Set `export_data_access_groups = FALSE` if you do not intend to export data
349+
#> access groups.
350+
#> Caused by error in `redcap_dag_read()`:
351+
#> ! The REDCapR read/export operation was not successful. The error message was:
352+
#> ERROR: Insufficient user privileges: You must have 'API Export' privileges and 'Data Access Groups' privileges in the project.
341353
```
342354

343-
<sup>Created on 2024-10-16 with [reprex v2.1.0](https://reprex.tidyverse.org)</sup>
355+
<sup>Created on 2025-05-30 with [reprex v2.1.0](https://reprex.tidyverse.org)</sup>

0 commit comments

Comments
 (0)