Skip to content

Commit

Permalink
Manual removal of pem
Browse files Browse the repository at this point in the history
- testthat intermediate outputs do not seem ephemeral: manual removal is enforced
  • Loading branch information
sigmafelix committed Feb 8, 2024
1 parent 7ffa63e commit d986d72
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
5 changes: 3 additions & 2 deletions R/download.R
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,8 @@ download_ecoregion_data <- function(
#### 5. define download URL
download_epa_certificate(
epa_certificate_path = epa_certificate_path,
certificate_url = certificate_url)
certificate_url = certificate_url
)

download_url <- paste0(
"https://gaftp.epa.gov/EPADataCommons/ORD/Ecoregions/us/",
Expand Down Expand Up @@ -2448,7 +2449,7 @@ download_nei_data <- function(
system.file("extdata/cacert_gaftp_epa.pem",
package = "amadeus"),
certificate_url =
"http://cacerts.digicert.com/DigiCertGlobalG2TLSRSASHA2562020CA1-1.crt"
"http://cacerts.digicert.com/DigiCertGlobalG2TLSRSASHA2562020CA1-1.crt"
) {
#### 1. check for data download acknowledgement
download_permit(data_download_acknowledgement = data_download_acknowledgement)
Expand Down
12 changes: 12 additions & 0 deletions tests/testthat/test-download_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -1058,6 +1058,12 @@ testthat::test_that("Test error cases in EPA gaftp sources 1", {
tdir <- tempdir()
directory_to_save <- testthat::test_path("..", "testdata/", "")
certificate <- file.path(tdir, "cacert_gaftp_epa.pem")
# remove if there is a preexisting file
if (file.exists(certificate)) {
file.remove(certificate)
file.remove(gsub("pem", "crt", certificate))
}

# run download function
year_target <- c(2017L)
testthat::expect_message(
Expand Down Expand Up @@ -1091,6 +1097,12 @@ testthat::test_that("Test error cases in EPA gaftp sources 2", {
tdir <- tempdir(check = TRUE)
directory_to_save <- testthat::test_path("..", "testdata/", "")
certificate <- file.path(tdir, "cacert_gaftp_epa.pem")
# remove if there is a preexisting file
if (file.exists(certificate)) {
file.remove(certificate)
file.remove(gsub("pem", "crt", certificate))
}

# run download function

testthat::expect_message(
Expand Down

0 comments on commit d986d72

Please # to comment.