Skip to content

Commit 2d041b6

Browse files
authored
Update test suite and ci (#160)
* Bump vcr version requirement to >= 2.0.0 - Replace rprojroot-based cassette_dir() with vcr::vcr_test_path() - Remove filter_sensitive_data: vcr 2.x auto-strips Authorization headers from cassettes - Replace log/log_opts config with vcr_configure_log() * Fix Waterbutler conflict error detection Waterbutler no longer includes a 'code' key in conflict (409) error responses. The response body now contains only 'message' and 'data' (flat file attributes). Update .process_wb_response() to detect errors by the presence of a 'message' key in addition to the previous 'code' key check. * Re-record all 75 vcr cassettes against test.osf.io * Add dev version * Update NEWS.md * Update actions/checkout to v4 * Impose read-all permissions on gha workflow * Specify build args in check-r-package * Stop using deprecated testthat patterns - context() is long gone - Replace setup/teardown w/ modern withr functions - Replace use_cassette() with vcr::local_cassette() * Add withr to suggests * Specify winslash for consistent file seps on windows
1 parent 67315ad commit 2d041b6

158 files changed

Lines changed: 10308 additions & 11710 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/R-CMD-check.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ on:
66
pull_request:
77
branches: [main, master]
88

9-
name: R-CMD-check
9+
name: R-CMD-check.yaml
10+
11+
permissions: read-all
1012

1113
jobs:
1214
R-CMD-check:
@@ -18,7 +20,7 @@ jobs:
1820
fail-fast: false
1921
matrix:
2022
config:
21-
- {os: macOS-latest, r: 'release'}
23+
- {os: macos-latest, r: 'release'}
2224
- {os: windows-latest, r: 'release'}
2325
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
2426
- {os: ubuntu-latest, r: 'release'}
@@ -31,7 +33,7 @@ jobs:
3133
OSF_PAT: ${{ secrets.OSF_PAT }}
3234

3335
steps:
34-
- uses: actions/checkout@v2
36+
- uses: actions/checkout@v4
3537

3638
- uses: r-lib/actions/setup-pandoc@v2
3739

@@ -49,3 +51,4 @@ jobs:
4951
- uses: r-lib/actions/check-r-package@v2
5052
with:
5153
upload-snapshots: true
54+
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'

DESCRIPTION

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: osfr
22
Title: Interface to the 'Open Science Framework' ('OSF')
3-
Version: 0.2.9
3+
Version: 0.2.9.9000
44
Authors@R: c(
55
person("Aaron", "Wolen",, "aaron@wolen.com", role = c("aut", "cre"),
66
comment = c(ORCID = "0000-0003-2542-2202")),
@@ -46,7 +46,8 @@ Suggests:
4646
lintr (>= 2.0),
4747
covr,
4848
spelling,
49-
vcr (>= 0.5)
49+
vcr (>= 2.0.0),
50+
withr
5051
Encoding: UTF-8
5152
Language: en-US
5253
Roxygen: list(markdown = TRUE)

NEWS.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
# osfr (development version)
2+
3+
## Fixes
4+
5+
* Fixed `osf_mv()` and `osf_cp()` failing with an uninformative error when a conflict is encountered. Waterbutler dropped the `code` field from conflict (409) responses, which prevented the error message from being extracted and surfaced correctly.
6+
7+
## Build and test infrastructure
8+
9+
* Updated vcr dependency to 2.0 and leverage new helpers: `vcr::vcr_test_path()` and `vcr::vcr_configure_log()`.
10+
* Removed `filter_sensitive_data` since vcr 2.x auto-strips `Authorization` headers from cassettes.
11+
112
# osfr 0.2.9
213

314
## Minor changes

R/utils-api-responses.R

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,18 @@ process_response <- function(res) {
5858

5959
.process_wb_response <- function(x) {
6060

61-
# waterbutler errors contain a key code with the http status code and a key
62-
# message with the error message
63-
if (is.null(x$code)) {
64-
# waterbutler returns modified and modified_utc, to be consistent with osf
65-
# responses we store the `modified_utc` value in the `modified`
66-
x$data$attributes$modified <- parse_datetime(x$data$attributes$modified_utc)
67-
x$data$attributes$modified_utc <- NULL
68-
69-
} else {
61+
# Waterbutler errors contain a `message` key. Older versions also included a
62+
# `code` key with the HTTP status code, but current versions omit it.
63+
if (!is.null(x$code) || !is.null(x$message)) {
7064
# reformat waterbutler's error response to be consistent with OSF's
7165
x <- list(
7266
errors = list(list(detail = x$message))
7367
)
68+
} else {
69+
# waterbutler returns modified and modified_utc, to be consistent with osf
70+
# responses we store the `modified_utc` value in the `modified`
71+
x$data$attributes$modified <- parse_datetime(x$data$attributes$modified_utc)
72+
x$data$attributes$modified_utc <- NULL
7473
}
7574
x
7675
}

tests/cassettes/directories/create-dir-with-dot-prefix.yml

Lines changed: 103 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/cassettes/directories/create-dir.yml

Lines changed: 122 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)