Skip to content

Commit

Permalink
Update test conditions.
Browse files Browse the repository at this point in the history
  • Loading branch information
rfsaldanha committed Apr 14, 2024
1 parent 2bc3488 commit efa38ae
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions tests/testthat/test-functions.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
test_that("delete_mirror works with temporary cache", {
skip_if(!(curl::has_internet() & RCurl::url.exists("https://zenodo.org/records/10959197", timeout.ms = 5000)))
testthat::skip_on_cran()

res <- zen_file(deposit_id = 10959197, file_name = "iris.rds", cache_type = "temporary", clear_cache = TRUE, quiet = TRUE)

Expand All @@ -12,7 +12,7 @@ test_that("delete_mirror works with temporary cache", {
})

test_that("delete_mirror works with persistent cache", {
skip_if(!(curl::has_internet() & RCurl::url.exists("https://zenodo.org/records/10959197", timeout.ms = 5000)))
testthat::skip_on_cran()

res <- zen_file(deposit_id = 10959197, file_name = "iris.rds", cache_type = "persistent", clear_cache = TRUE, quiet = TRUE)

Expand All @@ -25,15 +25,15 @@ test_that("delete_mirror works with persistent cache", {
})

test_that("file_list works", {
skip_if(!(curl::has_internet() & RCurl::url.exists("https://zenodo.org/records/10959197", timeout.ms = 5000)))
testthat::skip_on_cran()

res <- list_deposit(deposit_id = 10959197)

expect_true("tbl_df" %in% class(res))
})

test_that("download_deposit works with file list", {
skip_if(!(curl::has_internet() & RCurl::url.exists("https://zenodo.org/records/10959197", timeout.ms = 5000)))
testthat::skip_on_cran()

res <- list_deposit(deposit_id = 10959197)

Expand All @@ -45,7 +45,7 @@ test_that("download_deposit works with file list", {
})

test_that("download_deposit works with single file", {
skip_if(!(curl::has_internet() & RCurl::url.exists("https://zenodo.org/records/10959197", timeout.ms = 5000)))
testthat::skip_on_cran()

res <- list_deposit(deposit_id = 10959197)

Expand All @@ -57,38 +57,40 @@ test_that("download_deposit works with single file", {
})

test_that("mirror_deposit works with temporary cache", {
skip_if(!(curl::has_internet() & RCurl::url.exists("https://zenodo.org/records/10959197", timeout.ms = 5000)))
testthat::skip_on_cran()

res <- mirror_deposit(deposit_id = 10959197, cache_type = "temporary", clear_cache = TRUE, quiet = TRUE)

expect_true(dir.exists(res))
})

test_that("mirror_deposit works with persistent cache", {
skip_if(!(curl::has_internet() & RCurl::url.exists("https://zenodo.org/records/10959197", timeout.ms = 5000)))
testthat::skip_on_cran()

res <- mirror_deposit(deposit_id = 10959197, cache_type = "persistent", clear_cache = TRUE, quiet = TRUE)

expect_true(dir.exists(res))
})

test_that("mirror_deposit works with single file", {
skip_if(!(curl::has_internet() & RCurl::url.exists("https://zenodo.org/records/10959197", timeout.ms = 5000)))
testthat::skip_on_cran()

res <- mirror_deposit(deposit_id = 10959197, file_name = "iris.rds", clear_cache = TRUE, quiet = TRUE)

expect_true(dir.exists(res))
})

test_that("zen_file works", {
skip_if(!(curl::has_internet() & RCurl::url.exists("https://zenodo.org/records/10959197", timeout.ms = 5000)))
testthat::skip_on_cran()

res <- zen_file(deposit_id = 10959197, file_name = "iris.rds", clear_cache = TRUE, quiet = TRUE)

expect_true(file.exists(res))
})

test_that("list_deposit without internet", {
testthat::skip_on_cran()

local_mocked_bindings(check_internet = function(...) FALSE)

suppressMessages({
Expand Down

0 comments on commit efa38ae

Please sign in to comment.