From ccd48dd78a1f5b83f12cf32e5328980238944db6 Mon Sep 17 00:00:00 2001 From: "miriam.baglioni" Date: Fri, 25 Sep 2020 16:33:43 +0200 Subject: [PATCH] added new test for new method --- .../dhp/common/api/ZenodoAPIClientTest.java | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/dhp-common/src/test/java/eu/dnetlib/dhp/common/api/ZenodoAPIClientTest.java b/dhp-common/src/test/java/eu/dnetlib/dhp/common/api/ZenodoAPIClientTest.java index f961d6748..ef6524eda 100644 --- a/dhp-common/src/test/java/eu/dnetlib/dhp/common/api/ZenodoAPIClientTest.java +++ b/dhp-common/src/test/java/eu/dnetlib/dhp/common/api/ZenodoAPIClientTest.java @@ -11,7 +11,7 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -@Disabled +//@Disabled public class ZenodoAPIClientTest { private final String URL_STRING = "https://sandbox.zenodo.org/api/deposit/depositions"; @@ -19,6 +19,30 @@ public class ZenodoAPIClientTest { private final String CONCEPT_REC_ID = "657113"; + private final String depositionId = "674915"; + + @Test + public void testUploadOldDeposition() throws IOException, MissingConceptDoiException { + ZenodoAPIClient client = new ZenodoAPIClient(URL_STRING, + ACCESS_TOKEN); + Assertions.assertEquals(200, client.uploadOpenDeposition(depositionId)); + + File file = new File(getClass() + .getResource("/eu/dnetlib/dhp/common/api/COVID-19.json.gz") + .getPath()); + + InputStream is = new FileInputStream(file); + + Assertions.assertEquals(200, client.uploadIS(is, "COVID-19.json.gz", file.length())); + + String metadata = IOUtils.toString(getClass().getResourceAsStream("/eu/dnetlib/dhp/common/api/metadata.json")); + + Assertions.assertEquals(200, client.sendMretadata(metadata)); + + Assertions.assertEquals(202, client.publish()); + + } + @Test public void testNewDeposition() throws IOException {