From 1b9a0ccc8e4fd067016a9de2b63ef2541f9bf211 Mon Sep 17 00:00:00 2001 From: philbosch Date: Tue, 4 Nov 2025 12:53:27 +0000 Subject: [PATCH 1/2] fix: add hard version dependencies --- DESCRIPTION | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 2058662..4244e9c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -13,15 +13,17 @@ License: MIT Encoding: UTF-8 Roxygen: list(markdown = TRUE) RoxygenNote: 7.3.1 +Depends: + R (>= 4.3.0) Imports: - S7, - httr2, + S7 (>= 0.2.0), + httr2 (>= 1.2.0), askpass, purrr, cli, dplyr, rlang, - curl, + curl (>= 7.0.0), tibble Collate: 'api-helpers.R' From eb0697cd50a9ed69f27e55437a28a6f7dcd99858 Mon Sep 17 00:00:00 2001 From: philbosch Date: Tue, 4 Nov 2025 15:53:01 +0000 Subject: [PATCH 2/2] fix: adapt test suite to test token --- tests/testthat/helper-integration.R | 4 ++-- tests/testthat/test-e2e-user-flows.R | 9 +++++++++ tests/testthat/test-integration-api.R | 9 +++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/tests/testthat/helper-integration.R b/tests/testthat/helper-integration.R index 176d8f5..4ac17db 100644 --- a/tests/testthat/helper-integration.R +++ b/tests/testthat/helper-integration.R @@ -9,13 +9,13 @@ skip_if_not_e2e <- function() { } # Require key - if (!nzchar(Sys.getenv("ZHAPIR_API_KEY"))) { + if (!nzchar(Sys.getenv("MDV_DEV_API_TOKEN_TEST"))) { testthat::skip("ZHAPIR_API_KEY missing; cannot run end-to-end tests.") } } skip_if_no_api_key <- function() { - if (nzchar(Sys.getenv("ZHAPIR_API_KEY")) == FALSE) + if (nzchar(Sys.getenv("MDV_DEV_API_TOKEN_TEST")) == FALSE) skip("no ZHAPIR_API_KEY; skipping integration tests") } diff --git a/tests/testthat/test-e2e-user-flows.R b/tests/testthat/test-e2e-user-flows.R index c231805..8efd16d 100644 --- a/tests/testthat/test-e2e-user-flows.R +++ b/tests/testthat/test-e2e-user-flows.R @@ -1,3 +1,12 @@ +testthat::local_mocked_bindings( + get_api_key = function(key = NULL) { + tok <- base::Sys.getenv("MDV_DEV_API_TOKEN_TEST") + if (!base::nzchar(tok)) base::stop("MDV_DEV_API_TOKEN_TEST not set") + tok + }, + .package = "zhapir" +) + test_that("E2E: distribution cannot exceed dataset status", { skip_if_not_e2e() diff --git a/tests/testthat/test-integration-api.R b/tests/testthat/test-integration-api.R index eeed303..64ae450 100644 --- a/tests/testthat/test-integration-api.R +++ b/tests/testthat/test-integration-api.R @@ -1,3 +1,12 @@ +testthat::local_mocked_bindings( + get_api_key = function(key = NULL) { + tok <- base::Sys.getenv("MDV_DEV_API_TOKEN_TEST") + if (!base::nzchar(tok)) base::stop("MDV_DEV_API_TOKEN_TEST not set") + tok + }, + .package = "zhapir" +) + test_that("convert_keywords_to_id actually finds known keywords", { skip_if_not_e2e() # This will do a real GET /keywords