From 673d775cd54989f9a29fd6cfbe1722a45e84b861 Mon Sep 17 00:00:00 2001 From: Philip Durbin Date: Wed, 4 Sep 2024 10:02:03 -0400 Subject: [PATCH] add test to assert capitalizataion of Dataset and Software #10517 --- .../iq/dataverse/api/DatasetTypesIT.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/test/java/edu/harvard/iq/dataverse/api/DatasetTypesIT.java b/src/test/java/edu/harvard/iq/dataverse/api/DatasetTypesIT.java index 35a354c6beb..1dec51cc3ef 100644 --- a/src/test/java/edu/harvard/iq/dataverse/api/DatasetTypesIT.java +++ b/src/test/java/edu/harvard/iq/dataverse/api/DatasetTypesIT.java @@ -87,6 +87,24 @@ public void testCreateSoftwareDatasetNative() { UtilIT.publishDataverseViaNativeApi(dataverseAlias, apiToken).then().assertThat().statusCode(OK.getStatusCode()); UtilIT.publishDatasetViaNativeApi(datasetPid, "major", apiToken).then().assertThat().statusCode(OK.getStatusCode()); + Response createDataset = UtilIT.createRandomDatasetViaNativeApi(dataverseAlias, apiToken); + createDataset.prettyPrint(); + createDataset.then().assertThat().statusCode(CREATED.getStatusCode()); + + String dataset2Pid = JsonPath.from(createDataset.getBody().asString()).getString("data.persistentId"); + + UtilIT.publishDatasetViaNativeApi(dataset2Pid, "major", apiToken).then().assertThat().statusCode(OK.getStatusCode()); + + Response searchCollection = UtilIT.searchAndShowFacets("parentName:" + dataverseAlias, null); + searchCollection.prettyPrint(); + searchCollection.then().assertThat() + .body("data.total_count", CoreMatchers.is(2)) + .body("data.count_in_response", CoreMatchers.is(2)) + .body("data.facets[0].datasetType.friendly", CoreMatchers.is("Dataset Type")) + .body("data.facets[0].datasetType.labels[0].Dataset", CoreMatchers.is(1)) + .body("data.facets[0].datasetType.labels[1].Software", CoreMatchers.is(1)) + .statusCode(OK.getStatusCode()); + // Response searchAsGuest = UtilIT.search(SearchFields.DATASET_TYPE + ":software", null); // searchAsGuest.prettyPrint(); // searchAsGuest.then().assertThat()