Skip to content

Commit

Permalink
Add unit test for s3
Browse files Browse the repository at this point in the history
  • Loading branch information
grimbough committed Aug 1, 2023
1 parent 3fa4b17 commit 92f7062
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ Suggests:
BiocStyle,
covr,
knitr,
tinytest
tinytest,
mockery
VignetteBuilder: knitr
SystemRequirements: GNU make
biocViews: DataImport
1 change: 1 addition & 0 deletions inst/tinytest/test_roundtrip.R
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,4 @@ expect_silent(
)
)
expect_identical(read_zarr_array(path), x)

15 changes: 15 additions & 0 deletions inst/tinytest/test_s3.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
path <- "https://www.test.com/bucket/file1"
s3_client <- Rarr:::.create_s3_client(path)

if(require(mockery)) {

## This ensures .get_credentials always returns an error, even if the
## host machine has credentials available
stub(where = Rarr:::.create_s3_client,
what = '.get_credentials',
how = function(...) stop(),
depth = 2)

## we expect an "anonymous" credential if nothing is found
expect_true(s3_client$.internal$config$credentials$anonymous)
}

0 comments on commit 92f7062

Please sign in to comment.