Skip to content

Commit

Permalink
Former tests may fail (fail to produce error) if run with elevated pe…
Browse files Browse the repository at this point in the history
…rmissions.
  • Loading branch information
bpvgoncalves committed Oct 18, 2023
1 parent 3e123b8 commit 6fad10a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions tests/testthat/test-envelope_write.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ test_that("Envelope writing works", {
"'envelope' parameter does not have the expected class")

if (Sys.info()[1] == "Linux") {
dest <- "/home/file.env" # Shouldn't be able to write into root's home dir
dest <- "/fake_path/file.env"
} else if ((Sys.info()[1] == "Windows")) {
dest <- "c:/Windows/system32/file.env" # Shouldn't be able to write into system dir
dest <- "z:/fake_path/file.env"
} else {
skip("Unknown OS")
}
expect_error(write_envelope(env, dest), "Permission denied")
expect_error(write_envelope(env, dest), "cannot open file")
})
12 changes: 6 additions & 6 deletions tests/testthat/test-signature_write.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ test_that("Signature Writing works: Dilithium", {
"'signature' parameter does not have the expected class")

if (Sys.info()[1] == "Linux") {
dest <- "/home/file.sig" # Shouldn't be able to write into root's home dir
dest <- "/fake_path/file.env"
} else if ((Sys.info()[1] == "Windows")) {
dest <- "c:/Windows/system32/file.sig" # Shouldn't be able to write into system dir
dest <- "z:/fake_path/file.env"
} else {
skip("Unknown OS")
}
expect_error(write_signature(signature, dest), "Permission denied")
expect_error(write_signature(signature, dest), "cannot open file")
})


Expand All @@ -48,11 +48,11 @@ test_that("Signature Writing works: Sphincs+", {
"'signature' parameter does not have the expected class")

if (Sys.info()[1] == "Linux") {
dest <- "/home/file.sig" # Shouldn't be able to write into root's home dir
dest <- "/fake_path/file.env"
} else if ((Sys.info()[1] == "Windows")) {
dest <- "c:/Windows/system32/file.sig" # Shouldn't be able to write into system dir
dest <- "z:/fake_path/file.env"
} else {
skip("Unknown OS")
}
expect_error(write_signature(signature, dest), "Permission denied")
expect_error(write_signature(signature, dest), "cannot open file")
})

0 comments on commit 6fad10a

Please sign in to comment.