Skip to content

Commit

Permalink
Adapted proxy settings check output to be more consistent with rest o…
Browse files Browse the repository at this point in the history
…f checks output
  • Loading branch information
rmbielby committed Nov 12, 2024
1 parent 42e0600 commit 03f0437
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
2 changes: 2 additions & 0 deletions R/diagnostic_test.R
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ check_proxy_settings <- function(
}
} else {
message("PASS: No proxy settings found in your Git configuration.")
proxy_config <- as.list(rep("", length(proxy_setting_names))) |>
setNames(proxy_setting_names)
}
return(proxy_config)
}
Expand Down
21 changes: 17 additions & 4 deletions tests/testthat/test-diagnostic_test.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
test_that("Check proxy settings identifies and removes proxy setting", {
# Set a dummy config parameter for the purposes of testing
git2r::config(http.proxy.test = "this-is-a-test-entry", global = TRUE)
proxy_setting_names = c("http.proxy.test", "https.proxy.test")

Check warning on line 4 in tests/testthat/test-diagnostic_test.R

View workflow job for this annotation

GitHub Actions / lint

file=tests/testthat/test-diagnostic_test.R,line=4,col=23,[assignment_linter] Use <-, not =, for assignment.
# Check that check_proxy_settings identifies the rogue entry
expect_equal(
check_proxy_settings(
proxy_setting_names = c("http.proxy.test", "https.proxy.test"),
proxy_setting_names = proxy_setting_names,
clean = FALSE
) |>
suppressMessages(),
Expand All @@ -13,7 +14,7 @@ test_that("Check proxy settings identifies and removes proxy setting", {
# Run the check in clean mode
expect_equal(
check_proxy_settings(
proxy_setting_names = c("http.proxy.test", "https.proxy.test"),
proxy_setting_names = proxy_setting_names,
clean = TRUE
) |>
suppressMessages(),
Expand All @@ -22,10 +23,22 @@ test_that("Check proxy settings identifies and removes proxy setting", {
# And now run again to see if clean mode worked in removing the rogue setting
expect_equal(
check_proxy_settings(
proxy_setting_names = c("http.proxy.test", "https.proxy.test")
proxy_setting_names = proxy_setting_names
) |>
suppressMessages(),
purrr::keep(list(x = NULL), names(list(x = NULL)) != "x")
proxy_config <- as.list(rep("", length(proxy_setting_names))) |>
setNames(proxy_setting_names)
)
})

test_that("Test GITHUB_PAT diagnostic check", {
# Check that check_proxy_settings identifies the rogue entry
expect_equal(
check_github_pat(
clean = FALSE
) |>
suppressMessages(),
list(GITHUB_PAT = "")
)
})

Expand Down

0 comments on commit 03f0437

Please sign in to comment.