Skip to content

Commit

Permalink
fix zenodo tests with default accessrights = open #86
Browse files Browse the repository at this point in the history
  • Loading branch information
mpadge committed Jun 15, 2023
1 parent 6c1c4c4 commit 13d6171
Show file tree
Hide file tree
Showing 27 changed files with 367 additions and 356 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: deposits
Title: A universal client for depositing and accessing research data
anywhere
Version: 0.2.1.036
Version: 0.2.1.037
Authors@R:
person("Mark", "Padgham", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-2172-5265"))
Expand Down
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"codeRepository": "https://github.com/ropenscilabs/deposits",
"issueTracker": "https://github.com/ropenscilabs/deposits/issues",
"license": "https://spdx.org/licenses/MIT",
"version": "0.2.1.036",
"version": "0.2.1.037",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/helper-test-client.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ new_mock_deposit <- function (service = "zenodo") {
keywords = as.list (c ("beaver", "temperature"))
)
metadata$format <- "dataset"
} else if (service == "zenodo") {
metadata$accessRights <- "closed"
}

prfx <- ifelse (service == "zenodo", "zen", "fs")
Expand Down
30 changes: 21 additions & 9 deletions tests/testthat/test-client-zenodo.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ test_that ("zenodo new", {
creator = list (list (name = "A. Person"), list (name = "B. Person")),
description =
"## description\nThis is the description\n\n## version\n1.0",
subject = "## keywords\none, two\nthree"
subject = "## keywords\none, two\nthree",
accessRights = "closed"
)

cli <- with_mock_dir ("zen_client", {
Expand All @@ -38,10 +39,10 @@ test_that ("zenodo new", {
})
expect_s3_class (cli, "depositsClient")
expect_type (cli$metadata, "list")
expect_length (cli$metadata, 5L)
expect_length (cli$metadata, 6L)
expect_equal (
names (cli$metadata),
c ("abstract", "creator", "description", "subject", "title")
c ("abstract", "accessRights", "creator", "description", "subject", "title")
)
expect_type (cli$metadata, "list")
# expect_type (cli$metadata_service, "list") # now a private field
Expand Down Expand Up @@ -103,6 +104,9 @@ test_that ("zenodo default metadata", {
pos_txt <- grep ("This is the description", desc)
expect_true ((pos_txt - pos_title) > 0)
expect_true ((pos_txt - pos_title) <= 2)

# Expect access_right = "open":
expect_equal (metadata$service$metadata$access_right, "open")
})

test_that ("zenodo retrieve", {
Expand All @@ -117,7 +121,8 @@ test_that ("zenodo retrieve", {
creator = list (list (name = "A. Person"), list (name = "B. Person")),
description =
"## description\nThis is the description\n\n## version\n1.0",
subject = "## keywords\none, two\nthree"
subject = "## keywords\none, two\nthree",
accessRights = "closed"
)

# -------- DEPOSIT_RETRIEVE
Expand Down Expand Up @@ -149,7 +154,8 @@ test_that ("zenodo retrieve", {
creator = list (list (name = "C. Person")),
description =
"## description\nThis is the description\n\n## version\n1.0",
subject = "## keywords\none, two\nthree"
subject = "## keywords\none, two\nthree",
accessRights = "closed"
)

dep <- with_mock_dir ("zen_meta", {
Expand Down Expand Up @@ -218,7 +224,8 @@ test_that ("zenodo add_resource", {
creator = list (list (name = "A. Person"), list (name = "B. Person")),
description =
"## description\nThis is the description\n\n## version\n1.0",
subject = "## keywords\none, two\nthree"
subject = "## keywords\none, two\nthree",
accessRights = "closed"
)

cli <- with_mock_dir ("zen_client", {
Expand Down Expand Up @@ -270,7 +277,7 @@ test_that ("zenodo add_resource", {
expect_null (cli$hostdata)
expect_false (is.null (cli$metadata))
expect_type (cli$metadata, "list")
expect_length (cli$metadata, 5L)
expect_length (cli$metadata, 6L)

expect_identical (
cli$metadata [order (names (cli$metadata))],
Expand Down Expand Up @@ -456,11 +463,16 @@ test_that ("zenodo version", {
vers <- sprintf (paste0 ("%0", nc, "i"), as.integer (vers) + 1L)
vers <- gsub ("[0-9]*$", vers, vers0)

cre <- lapply (
cli$hostdata$metadata$creators$name,
function (i) list (name = i)
)
metadata <- list (
title = cli$hostdata$metadata$title,
description = cli$hostdata$metadata$description,
creator = list (as.list (cli$hostdata$metadata$creators)),
subject = list (version = vers)
creator = cre,
subject = list (version = vers),
accessRights = "closed"
)
cli$deposit_fill_metadata (metadata)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"orcid": "0000-0003-2172-5265"
}
],
"description": "<p>The &#39;R&#39; language includes a set of defined types, but the language itself is &quot;absurdly dynamic&quot; (Turcotte &amp; Vitek (2019)\\n), and lacks any way to specify which types are\\nexpected by any expression. The &#39;typetracer&#39; package enables code to be traced to extract detailed information on the properties of parameters\\npassed to &#39;R&#39; functions. &#39;typetracer&#39; can trace individual functions or\\nentire packages.<\/p>",
"description": "<p>The &#39;R&#39; language includes a set of defined types, but the language itself is &quot;absurdly dynamic&quot; (Turcotte &amp; Vitek (2019)\\n), and lacks any way to specify which types are expected by any expression. The &#39;typetracer&#39; package enables code to be traced to extract detailed information on the properties of parameters\\npassed to &#39;R&#39; functions. &#39;typetracer&#39; can trace individual functions or\\nentire packages.<\/p>",
"doi": "10.5072/zenodo.1206120",
"prereserve_doi": {
"doi": "10.5072/zenodo.1206120",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"orcid": "0000-0003-2172-5265"
}
],
"description": "<p>The &#39;R&#39; language includes a set of defined types, but the language itself is &quot;absurdly dynamic&quot; (Turcotte &amp; Vitek (2019)\\n), and lacks any way to specify which types are\\nexpected by any expression. The &#39;typetracer&#39; package enables code to be traced to extract detailed information on the properties of parameters\\npassed to &#39;R&#39; functions. &#39;typetracer&#39; can trace individual functions or\\nentire packages.<\/p>",
"description": "<p>The &#39;R&#39; language includes a set of defined types, but the language itself is &quot;absurdly dynamic&quot; (Turcotte &amp; Vitek (2019)\\n), and lacks any way to specify which types are expected by any expression. The &#39;typetracer&#39; package enables code to be traced to extract detailed information on the properties of parameters\\npassed to &#39;R&#39; functions. &#39;typetracer&#39; can trace individual functions or\\nentire packages.<\/p>",
"doi": "10.5072/zenodo.1206120",
"prereserve_doi": {
"doi": "10.5072/zenodo.1206120",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
{
"conceptrecid": "1206384",
"conceptrecid": "1212567",
"created": "2022-01-01T00:00:00+00:00",
"doi": "10.5072/zenodo.1206385",
"doi_url": "https://doi.org/10.5072/zenodo.1206385",
"doi": "10.5072/zenodo.1212568",
"doi_url": "https://doi.org/10.5072/zenodo.1212568",
"files": [
{
"checksum": "cc624d72ede85ef061afa494d9951f6f",
"filename": "data2.csv",
"filesize": 625,
"id": "5db3a8ed-f1a4-4346-bfd9-fcc282a22474",
"id": "d09dbc95-d0b1-4160-991e-6a1cd5a65438",
"links": {
"download": "sbapi/files/hash/data2.csv",
"self": "sbapi/deposit/depositions/1206385/files/5db3a8ed-f1a4-4346-bfd9-fcc282a22474"
"self": "sbapi/deposit/depositions/1212568/files/d09dbc95-d0b1-4160-991e-6a1cd5a65438"
}
},
{
"checksum": "cc624d72ede85ef061afa494d9951f6f",
"filename": "data.csv",
"filesize": 625,
"id": "62403d3f-eb11-475a-b9ac-5a3d92bb2c7d",
"id": "338840b3-793c-4a11-981f-834c69623438",
"links": {
"download": "sbapi/files/hash/data.csv",
"self": "sbapi/deposit/depositions/1206385/files/62403d3f-eb11-475a-b9ac-5a3d92bb2c7d"
"self": "sbapi/deposit/depositions/1212568/files/338840b3-793c-4a11-981f-834c69623438"
}
}
],
"id": 1206385,
"id": 1212568,
"links": {
"badge": "https://sandbox.zenodo.org/badge/doi/10.5072/zenodo.1206385.svg",
"bucket": "sbapi/files/c7365378-583d-47dc-88a6-4ea6442dad5c",
"discard": "sbapi/deposit/depositions/1206385/actions/discard",
"doi": "https://doi.org/10.5072/zenodo.1206385",
"edit": "sbapi/deposit/depositions/1206385/actions/edit",
"files": "sbapi/deposit/depositions/1206385/files",
"html": "https://sandbox.zenodo.org/deposit/1206385",
"latest_draft": "sbapi/deposit/depositions/1206385",
"latest_draft_html": "https://sandbox.zenodo.org/deposit/1206385",
"newversion": "sbapi/deposit/depositions/1206385/actions/newversion",
"publish": "sbapi/deposit/depositions/1206385/actions/publish",
"registerconceptdoi": "sbapi/deposit/depositions/1206385/actions/registerconceptdoi",
"self": "sbapi/deposit/depositions/1206385"
"badge": "https://sandbox.zenodo.org/badge/doi/10.5072/zenodo.1212568.svg",
"bucket": "sbapi/files/6fd82ad2-3cb2-4bf9-bfd2-83e38ecb7acc",
"discard": "sbapi/deposit/depositions/1212568/actions/discard",
"doi": "https://doi.org/10.5072/zenodo.1212568",
"edit": "sbapi/deposit/depositions/1212568/actions/edit",
"files": "sbapi/deposit/depositions/1212568/files",
"html": "https://sandbox.zenodo.org/deposit/1212568",
"latest_draft": "sbapi/deposit/depositions/1212568",
"latest_draft_html": "https://sandbox.zenodo.org/deposit/1212568",
"newversion": "sbapi/deposit/depositions/1212568/actions/newversion",
"publish": "sbapi/deposit/depositions/1212568/actions/publish",
"registerconceptdoi": "sbapi/deposit/depositions/1212568/actions/registerconceptdoi",
"self": "sbapi/deposit/depositions/1212568"
},
"metadata": {
"access_right": "closed",
Expand All @@ -52,15 +52,15 @@
}
],
"description": "## abstract\\n\\nThis is the abstract\\n\\n## description\\n\\nThis is the description",
"doi": "10.5072/zenodo.1206385",
"doi": "10.5072/zenodo.1212568",
"keywords": [
"one",
"two",
"three"
],
"prereserve_doi": {
"doi": "10.5072/zenodo.1206385",
"recid": 1206385
"doi": "10.5072/zenodo.1212568",
"recid": 1212568
},
"publication_date": "2022-01-01",
"title": "New Title",
Expand All @@ -69,7 +69,7 @@
},
"modified": "2022-01-01T00:00:00+00:00",
"owner": 115518,
"record_id": 1206385,
"record_id": 1212568,
"state": "unsubmitted",
"submitted": false,
"title": "New Title"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
{
"conceptrecid": "1206384",
"conceptrecid": "1212567",
"created": "2022-01-01T00:00:00+00:00",
"doi": "10.5072/zenodo.1206385",
"doi_url": "https://doi.org/10.5072/zenodo.1206385",
"doi": "10.5072/zenodo.1212568",
"doi_url": "https://doi.org/10.5072/zenodo.1212568",
"files": [
{
"checksum": "cc624d72ede85ef061afa494d9951f6f",
"filename": "data2.csv",
"filesize": 625,
"id": "5db3a8ed-f1a4-4346-bfd9-fcc282a22474",
"id": "d09dbc95-d0b1-4160-991e-6a1cd5a65438",
"links": {
"download": "sbapi/files/hash/data2.csv",
"self": "sbapi/deposit/depositions/1206385/files/5db3a8ed-f1a4-4346-bfd9-fcc282a22474"
"self": "sbapi/deposit/depositions/1212568/files/d09dbc95-d0b1-4160-991e-6a1cd5a65438"
}
},
{
"checksum": "cc624d72ede85ef061afa494d9951f6f",
"filename": "data.csv",
"filesize": 625,
"id": "62403d3f-eb11-475a-b9ac-5a3d92bb2c7d",
"id": "338840b3-793c-4a11-981f-834c69623438",
"links": {
"download": "sbapi/files/hash/data.csv",
"self": "sbapi/deposit/depositions/1206385/files/62403d3f-eb11-475a-b9ac-5a3d92bb2c7d"
"self": "sbapi/deposit/depositions/1212568/files/338840b3-793c-4a11-981f-834c69623438"
}
}
],
"id": 1206385,
"id": 1212568,
"links": {
"badge": "https://sandbox.zenodo.org/badge/doi/10.5072/zenodo.1206385.svg",
"bucket": "sbapi/files/c7365378-583d-47dc-88a6-4ea6442dad5c",
"discard": "sbapi/deposit/depositions/1206385/actions/discard",
"doi": "https://doi.org/10.5072/zenodo.1206385",
"edit": "sbapi/deposit/depositions/1206385/actions/edit",
"files": "sbapi/deposit/depositions/1206385/files",
"html": "https://sandbox.zenodo.org/deposit/1206385",
"latest_draft": "sbapi/deposit/depositions/1206385",
"latest_draft_html": "https://sandbox.zenodo.org/deposit/1206385",
"newversion": "sbapi/deposit/depositions/1206385/actions/newversion",
"publish": "sbapi/deposit/depositions/1206385/actions/publish",
"registerconceptdoi": "sbapi/deposit/depositions/1206385/actions/registerconceptdoi",
"self": "sbapi/deposit/depositions/1206385"
"badge": "https://sandbox.zenodo.org/badge/doi/10.5072/zenodo.1212568.svg",
"bucket": "sbapi/files/6fd82ad2-3cb2-4bf9-bfd2-83e38ecb7acc",
"discard": "sbapi/deposit/depositions/1212568/actions/discard",
"doi": "https://doi.org/10.5072/zenodo.1212568",
"edit": "sbapi/deposit/depositions/1212568/actions/edit",
"files": "sbapi/deposit/depositions/1212568/files",
"html": "https://sandbox.zenodo.org/deposit/1212568",
"latest_draft": "sbapi/deposit/depositions/1212568",
"latest_draft_html": "https://sandbox.zenodo.org/deposit/1212568",
"newversion": "sbapi/deposit/depositions/1212568/actions/newversion",
"publish": "sbapi/deposit/depositions/1212568/actions/publish",
"registerconceptdoi": "sbapi/deposit/depositions/1212568/actions/registerconceptdoi",
"self": "sbapi/deposit/depositions/1212568"
},
"metadata": {
"access_right": "closed",
Expand All @@ -52,15 +52,15 @@
}
],
"description": "## abstract\\n\\nThis is the abstract\\n\\n## description\\n\\nThis is the description",
"doi": "10.5072/zenodo.1206385",
"doi": "10.5072/zenodo.1212568",
"keywords": [
"one",
"two",
"three"
],
"prereserve_doi": {
"doi": "10.5072/zenodo.1206385",
"recid": 1206385
"doi": "10.5072/zenodo.1212568",
"recid": 1212568
},
"publication_date": "2022-01-01",
"title": "New Title",
Expand All @@ -69,7 +69,7 @@
},
"modified": "2022-01-01T00:00:00+00:00",
"owner": 115518,
"record_id": 1206385,
"record_id": 1212568,
"state": "unsubmitted",
"submitted": false,
"title": "New Title"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
{
"conceptrecid": "1206384",
"conceptrecid": "1212567",
"created": "2022-01-01T00:00:00+00:00",
"doi": "10.5072/zenodo.1206385",
"doi_url": "https://doi.org/10.5072/zenodo.1206385",
"doi": "10.5072/zenodo.1212568",
"doi_url": "https://doi.org/10.5072/zenodo.1212568",
"files": [

],
"id": 1206385,
"id": 1212568,
"links": {
"badge": "https://sandbox.zenodo.org/badge/doi/10.5072/zenodo.1206385.svg",
"bucket": "sbapi/files/c7365378-583d-47dc-88a6-4ea6442dad5c",
"discard": "sbapi/deposit/depositions/1206385/actions/discard",
"doi": "https://doi.org/10.5072/zenodo.1206385",
"edit": "sbapi/deposit/depositions/1206385/actions/edit",
"files": "sbapi/deposit/depositions/1206385/files",
"html": "https://sandbox.zenodo.org/deposit/1206385",
"latest_draft": "sbapi/deposit/depositions/1206385",
"latest_draft_html": "https://sandbox.zenodo.org/deposit/1206385",
"newversion": "sbapi/deposit/depositions/1206385/actions/newversion",
"publish": "sbapi/deposit/depositions/1206385/actions/publish",
"registerconceptdoi": "sbapi/deposit/depositions/1206385/actions/registerconceptdoi",
"self": "sbapi/deposit/depositions/1206385"
"badge": "https://sandbox.zenodo.org/badge/doi/10.5072/zenodo.1212568.svg",
"bucket": "sbapi/files/6fd82ad2-3cb2-4bf9-bfd2-83e38ecb7acc",
"discard": "sbapi/deposit/depositions/1212568/actions/discard",
"doi": "https://doi.org/10.5072/zenodo.1212568",
"edit": "sbapi/deposit/depositions/1212568/actions/edit",
"files": "sbapi/deposit/depositions/1212568/files",
"html": "https://sandbox.zenodo.org/deposit/1212568",
"latest_draft": "sbapi/deposit/depositions/1212568",
"latest_draft_html": "https://sandbox.zenodo.org/deposit/1212568",
"newversion": "sbapi/deposit/depositions/1212568/actions/newversion",
"publish": "sbapi/deposit/depositions/1212568/actions/publish",
"registerconceptdoi": "sbapi/deposit/depositions/1212568/actions/registerconceptdoi",
"self": "sbapi/deposit/depositions/1212568"
},
"metadata": {
"access_right": "embargoed",
Expand All @@ -33,7 +33,7 @@
}
],
"description": "## abstract\\n\\nThis is the abstract\\n\\n## description\\n\\nThis is the description",
"doi": "10.5072/zenodo.1206385",
"doi": "10.5072/zenodo.1212568",
"embargo_date": "2022-01-01",
"keywords": [
"one",
Expand All @@ -42,8 +42,8 @@
],
"license": "CC-BY-4.0",
"prereserve_doi": {
"doi": "10.5072/zenodo.1206385",
"recid": 1206385
"doi": "10.5072/zenodo.1212568",
"recid": 1212568
},
"publication_date": "2022-01-01",
"title": "New Title",
Expand All @@ -52,7 +52,7 @@
},
"modified": "2022-01-01T00:00:00+00:00",
"owner": 115518,
"record_id": 1206385,
"record_id": 1212568,
"state": "unsubmitted",
"submitted": false,
"title": "New Title"
Expand Down
Loading

0 comments on commit 13d6171

Please sign in to comment.