Skip to content

Commit

Permalink
update after publish the dataset
Browse files Browse the repository at this point in the history
ref #4
  • Loading branch information
wibeasley committed Apr 22, 2020
1 parent a5e0709 commit 87152a8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
1 change: 1 addition & 0 deletions tests/testthat/tests-dataverse_contents.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ test_that("dataverse for 'dataverse-client-r'", {
protocol = "doi",
authority = "10.70122",
publisher = "Demo Dataverse",
publicationDate = "2020-04-22",
storageIdentifier = "file://10.70122/FK2/FAN622",
type = "dataset"
),
Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/tests-get_dataset.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ test_that("download tab from DOI and filename", {
actual <- get_dataset(contents[[1]])
files <- actual$files

expect_length(actual , 13L)
expect_length(actual , 16L)
expect_equal(actual$id , 53155L)
expect_equal(actual$datasetId , 396356L)
expect_equal(actual$datasetPersistentId , "doi:10.70122/FK2/FAN622")
expect_equal(actual$storageIdentifier , "file://10.70122/FK2/FAN622")
expect_equal(actual$versionState , "DRAFT")
expect_equal(actual$versionState , "RELEASED")
expect_equal(actual$UNF , "UNF:6:hrleySyT6vzwEih3+nhp8A==")
expect_equal(actual$license , "CC0")

Expand All @@ -25,8 +25,8 @@ test_that("download tab from DOI and filename", {
expect_equal(files$datasetVersionId , c(53155L, 53155L))
expect_equal(files$directoryLabel , c(NA, "resources"))
expect_equal(files$id , c(396357L, 769385L))
expect_equal(files$persistentId , c("", ""))
expect_equal(files$pidURL , c("", ""))
expect_equal(files$persistentId , c("doi:10.70122/FK2/FAN622/FIIFV8", "doi:10.70122/FK2/FAN622/ZZE4B0"))
expect_equal(files$pidURL , c("https://doi.org/10.70122/FK2/FAN622/FIIFV8", "https://doi.org/10.70122/FK2/FAN622/ZZE4B0"))
expect_equal(files$filename , c("roster-bulls-1996.tab", "vector-basketball.svg"))
expect_equal(files$description , c(NA, "CC-0-from-https://publicdomainvectors.org/en/free-clipart/Basketball-vector-symbol/69448.html"))

Expand Down
11 changes: 7 additions & 4 deletions tests/testthat/tests-get_file.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,21 @@ test_that("download tab from file id", {
})

test_that("download multiple files with file id - no folder", {
file_ids <- get_dataset("doi:10.70122/FK2/LZAJEQ", server = "demo.dataverse.org")[['files']]$id
# file_ids <- get_dataset("doi:10.70122/FK2/LZAJEQ", server = "demo.dataverse.org")[['files']]$id
file_ids <- get_dataset("doi:10.70122/FK2/FAN622", server = "demo.dataverse.org")[['files']]$id
actual <- get_file(
file_ids,
format="original",
server = "demo.dataverse.org")
format = "original",
server = "demo.dataverse.org"
)
expect_true(length(actual) == 2) # two files in the dataset
expect_true(is.raw(actual[[2]]))
expect_true(object.size(actual[[2]]) > 300) # Should be >300 B
})

test_that("download multiple files with file id - with folders", {
file_ids <- get_dataset("doi:10.70122/FK2/V54HGA", server = "demo.dataverse.org")[['files']]$id
# file_ids <- get_dataset("doi:10.70122/FK2/V54HGA", server = "demo.dataverse.org")[['files']]$id
file_ids <- get_dataset("doi:10.70122/FK2/FAN622", server = "demo.dataverse.org")[['files']]$id
actual <- get_file(file_ids, format="original", server = "demo.dataverse.org")
expect_true(length(actual) == 2) # two files in the dataset
expect_true(is.raw(actual[[2]]))
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/tests-list_datasets.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ test_that("dataverse for 'dataverse-client-r'", {
uri = "http://www.swordapp.org/",
version = "2.0"
),
dataverseHasBeenReleased = "false",
dataverseHasBeenReleased = "true",
datasets = structure(
list(
title = structure(
Expand Down

0 comments on commit 87152a8

Please sign in to comment.