Commit 991dfcf
authored
Enable offline cassette replay for VCR-backed tests (#161)
* Remove remaining context() calls
* Define node test fixtures at file level
* Simplify osf_tbl stacking test
* Define upload test fixture at file-level
* Replace skip_on_production_server() with appropriate skip helpers
Rename skip_on_production_server() to skip_if_not_test_server() for
tests that depend on pre-existing assets on test.osf.io (test-osf_ls),
and switch to skip_if_no_pat() for tests that require authentication
(test-osf_tbl).
* Add skip_if_not_test_server() and README
Add skip_if_not_test_server() for tests that depend on pre-existing
assets on test.osf.io. Apply it to test-downloading.R (alongside
skip_if_no_pat) and the test-osf_tbl "can't combine" test that uses a
hardcoded test server GUID.
Add a README documenting the three testing modes (offline with
cassettes, live test server, live production server) and the skip
helpers.
* Add VCR cassettes for osf_ls and osf_tbl
Wrap API calls in vcr::use_cassette() so these tests replay recorded
responses instead of requiring a live connection to test.osf.io. This
brings them in line with the rest of the test suite.
* Enable offline cassette replay for VCR-backed tests
Remove `if (has_pat())` guards from setup blocks and `skip_if_no_pat()`
from individual tests so VCR cassettes replay without credentials.
Teardown blocks that conditionally clean up live resources are kept
unchanged. Also remove the unnecessary skip from the pure `id_type()`
test in test-identifiers.R.
Offline results improve from ~30 pass / ~74 skip to 150 pass / 9 skip,
with all remaining skips in test-downloading.R (which requires live
file access).1 parent 2d041b6 commit 991dfcf
30 files changed
Lines changed: 2136 additions & 208 deletions
File tree
- tests
- cassettes
- osf-ls
- osf-tbl
- testthat
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments