-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure that
check_workspace_param()
uses arg val rather than env val
Closes #54 - Has function budy use args rather than env values - Add tests for `check_workspace_param()` - Function uses vals in args - Function returns TRUE when right creds provided
- Loading branch information
1 parent
8bb0dcd
commit d58bb34
Showing
2 changed files
with
37 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# uses credentials in args rather than in environment | ||
testthat::test_that("Credentials in args rather than those in env", { | ||
|
||
# set SuSo environment vars as empty, emulatinng situation where | ||
# - no `.Renviron` file exists and/or | ||
# - credentials not set | ||
withr::local_envvar( | ||
.new = list( | ||
"SUSO_SERVER" = "", | ||
"SUSO_WORKSPACE" = "", | ||
"SUSO_USER" = "", | ||
"SUSO_PASSWORD" = "" | ||
) | ||
) | ||
|
||
testthat::expect_error( | ||
check_workspace_param( | ||
server = "https://demo.mysurvey.solutions", | ||
workspace = "fakespace", | ||
user = "FakeX1", | ||
password = "Fake123456" | ||
), | ||
'User `FakeX1` does not have access to workspace `fakespace`.' | ||
) | ||
|
||
}) | ||
|
||
# returns TRUE when correct credentials provided | ||
testthat::test_that("Returns `TRUE` when correct credentials provided", { | ||
|
||
testthat::expect_true( | ||
check_workspace_param() | ||
) | ||
|
||
}) |