Skip to content

Commit

Permalink
add codemeta block
Browse files Browse the repository at this point in the history
  • Loading branch information
pdurbin committed Oct 30, 2024
1 parent 30ab3e9 commit 57a743f
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/test/java/edu/harvard/iq/dataverse/api/DatasetTypesIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import static jakarta.ws.rs.core.Response.Status.CREATED;
import static jakarta.ws.rs.core.Response.Status.FORBIDDEN;
import static jakarta.ws.rs.core.Response.Status.OK;
import java.io.IOException;
import java.nio.file.Paths;
import java.util.UUID;
import org.hamcrest.CoreMatchers;
import static org.hamcrest.CoreMatchers.equalTo;
Expand Down Expand Up @@ -392,9 +394,21 @@ public void testUpdateDatasetTypeLinksWithMetadataBlocks() {
// @Disabled
@Test
public void testLinkSoftwareToCodemeta() {
// public void testLinkSoftwareToCompWork() {
Response listBlocksAvailable = UtilIT.listMetadataBlocks(false, true);
// if (true) {return;}
Response listBlocksAvailable = UtilIT.listMetadataBlocks(false, false);
listBlocksAvailable.then().assertThat().statusCode(OK.getStatusCode());
String blocksAsString = JsonPath.from(listBlocksAvailable.getBody().asString()).getString("data");
System.out.println("blocks: " + blocksAsString);
if (!blocksAsString.contains("codeMeta20")) {
System.out.println("CodeMeta hasn't been added. Adding it...");
byte[] codemetaTsv = null;
try {
codemetaTsv = java.nio.file.Files.readAllBytes(Paths.get("scripts/api/data/metadatablocks/codemeta.tsv"));
} catch (IOException e) {
}
UtilIT.loadMetadataBlock("", codemetaTsv);
} else {
System.out.println("CodeMeta has already been added.");
}

Response createUser = UtilIT.createRandomUser();
createUser.then().assertThat().statusCode(OK.getStatusCode());
Expand Down Expand Up @@ -456,7 +470,7 @@ public void testLinkSoftwareToCodemeta() {
listBlocks.then().assertThat()
.statusCode(OK.getStatusCode())
.body("data[0].name", is("citation"))
// .body("data[1].name", is("codeMeta20"))
// .body("data[1].name", is("codeMeta20"))
.body("data[2].name", nullValue())
// why not shown?
.body("data[0].fields.title.displayOnCreate", equalTo(true)); //failing, why? not present
Expand Down

0 comments on commit 57a743f

Please sign in to comment.