From 558c3bd2ae54abf69918124017b356e5bc1081a7 Mon Sep 17 00:00:00 2001 From: William Gearty Date: Mon, 1 Apr 2024 10:36:03 -0400 Subject: [PATCH] Check API endpoint URLs for APIs that aren't subdomains --- tests/testthat/test-resolve_phylopic.R | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/testthat/test-resolve_phylopic.R b/tests/testthat/test-resolve_phylopic.R index effa040..4b2e3be 100644 --- a/tests/testthat/test-resolve_phylopic.R +++ b/tests/testthat/test-resolve_phylopic.R @@ -38,6 +38,8 @@ test_that("resolve_phylopic works with GBIF", { test_that("resolve_phylopic works with EOL", { skip_if_offline(host = "eol.org") + tryCatch(check_url("https://eol.org/api/search/1.0.json"), + error = function(e) skip()) skip_if_offline(host = "api.phylopic.org") res <- resolve_phylopic(name = "Enhydra lutris", api = "eol.org") expect_equal(length(res), 1) @@ -66,6 +68,8 @@ test_that("resolve_phylopic works with EOL", { test_that("resolve_phylopic works with WoRMS", { skip_if_offline(host = "marinespecies.org") + tryCatch(check_url("https://www.marinespecies.org/rest/"), + error = function(e) skip()) skip_if_offline(host = "api.phylopic.org") res <- resolve_phylopic(name = "Enhydra lutris", api = "marinespecies.org") expect_equal(length(res), 1) @@ -92,6 +96,8 @@ test_that("resolve_phylopic works with WoRMS", { test_that("resolve_phylopic works with PBDB", { skip_if_offline(host = "paleobiodb.org") + tryCatch(check_url("https://paleobiodb.org/data1.2/"), + error = function(e) skip()) skip_if_offline(host = "api.phylopic.org") res <- resolve_phylopic(name = "Velociraptor mongoliensis", api = "paleobiodb.org")