Skip to content

Commit f8e09c2

Browse files
committed
fix: add interactive flag to some tests of keyring behaviour
1 parent b761ec4 commit f8e09c2

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

tests/testthat/test-api_key.R

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,19 @@ test_that("You can set and get an API key (with keyring support)", {
2828

2929
# In backends with keyring support, errors should be thrown if the API key is
3030
# an empty string
31-
keyring::key_set_with_value(service = "OPENFDA_KEY",
31+
if (interactive()) {
32+
keyring::key_set_with_value(service = "OPENFDA_KEY",
3233
username = "openFDA",
3334
password = "",
3435
keyring = "openFDA")
35-
expect_error(get_api_key(), class = "openFDA_api_key_empty")
36+
expect_error(get_api_key(), class = "openFDA_api_key_empty")
37+
}
38+
39+
# Set value to a valid API key before ending this block of tests
40+
expect_message(
41+
expect_null(set_api_key(decrypted_key)),
42+
class = "openfda_api_key_set"
43+
)
3644
})
3745

3846
# API key editing without keyrings are supported -------------------------------

0 commit comments

Comments
 (0)