Skip to content

Commit

Permalink
fix: Test suite will now skip for HTTP error tests
Browse files Browse the repository at this point in the history
  • Loading branch information
simpar1471 committed Oct 16, 2024
1 parent ccc131d commit ab40f4a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion R/check_args.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ check_warn_on_http_error_arg <- function(warn_on_http_error,
message = paste0("{.var warn_on_http_error} must not be missing ",
"({.val {warn_on_http_error}})."),
call = call,
class = "openFDA_warn_on_http_error_is_NA"
class = "openFDA_wohe_is_NA"
)
}
}
Expand Down
12 changes: 7 additions & 5 deletions tests/testthat/test-openFDA.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
test_that("openFDA can call its API", {
skip_on_cran()
encrypted_api_key <-
"TEaDtqdFMq9_Montij5p9IY6T57IyqkbF8IYFVOpk-ttxotFUNdJSxgccAnkq4nQhplaf-r3deQ"
encrypted_api_key <-
"TEaDtqdFMq9_Montij5p9IY6T57IyqkbF8IYFVOpk-ttxotFUNdJSxgccAnkq4nQhplaf-r3deQ"

test_that("openFDA can call its API", {
set_api_key(httr2::secret_decrypt(encrypted_api_key, "OPENFDA_KEY"))

# Simple query
Expand All @@ -15,6 +14,8 @@ test_that("openFDA can call its API", {


test_that("openFDA throws formatted HTTP errors", {
set_api_key(httr2::secret_decrypt(encrypted_api_key, "OPENFDA_KEY"))

# Error 400
expect_warning(
resp <- openFDA(
Expand Down Expand Up @@ -152,7 +153,8 @@ test_that("openFDA errors on certain bad inputs", {
class = "openFDA_wohe_invalid_length"
)
expect_error(
openFDA(search = "", warn_on_http_error = NA)
openFDA(search = "", warn_on_http_error = NA),
class = "openFDA_wohe_is_NA"
)
})

0 comments on commit ab40f4a

Please sign in to comment.