-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for RosvDownload similar to other low level functions
- Loading branch information
Showing
1 changed file
with
22 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
without_internet({ | ||
test_that("Can create a well-formed RosvDownload object...", { | ||
rosv_dl_obj <- RosvDownload$new('RSEC-2023-6', ecosystem = 'CRAN') | ||
expect_equal(rosv_dl_obj$request, "https://osv-vulnerabilities.storage.googleapis.com/CRAN/RSEC-2023-6.json") | ||
|
||
rosv_dl_obj_all <- RosvDownload$new(ecosystem = 'CRAN') | ||
expect_equal(rosv_dl_obj_all$request, "https://osv-vulnerabilities.storage.googleapis.com/CRAN/all.zip") | ||
}) | ||
}) | ||
|
||
without_internet({ | ||
test_that("Check error checking on RosvDownload objects...", { | ||
|
||
# Must be character vector and ecosystem provided | ||
expect_error(RosvDownload$new(vuln_ids = 11111)) | ||
expect_error(RosvDownload$new(vuln_ids = NA_character_)) | ||
expect_error(RosvDownload$new(vuln_ids = c('RSEC-2023-6', NA_character_))) | ||
expect_error(RosvDownload$new(vuln_ids = c('RSEC-2023-6', 'RSEC-2023-6'), ecosystem = 'cRAN')) | ||
expect_no_error(RosvDownload$new(vuln_ids = c('RSEC-2023-6', 'RSEC-2023-6'), ecosystem = 'CRAN')) | ||
|
||
}) | ||
}) |