Skip to content

Commit cc5dd50

Browse files
committed
address comments
1 parent 460070e commit cc5dd50

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/test/java/edu/harvard/iq/dataverse/api/FilesIT.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4057,7 +4057,7 @@ public void testDownloadFileWithGuestbookResponse() throws IOException, JsonPars
40574057
assertTrue(guestbookResponses.prettyPrint().contains("My Name," + user2Email + ",My Institution,My Position"));
40584058

40594059
// Get Signed Download Url for guest with guestbook response using file's persistentId
4060-
// POST /api/access/dataset/:persistentId?persistentId=
4060+
// POST /api/access/datafile/:persistentId?persistentId=
40614061
downloadResponse = UtilIT.downloadFilesUrlWithGuestbookResponse(filePersistentId, null, guestbookResponseForGuest);
40624062
downloadResponse.prettyPrint();
40634063
downloadResponse.then().assertThat()
@@ -4158,6 +4158,7 @@ public void testGetFileCitationFormatted() {
41584158
@Disabled
41594159
public void testDownloadFileWithGuestbookResponseUsingBearerToken() throws IOException, JsonParseException {
41604160
msgt("testDownloadFileWithGuestbookResponseUsingBearerToken");
4161+
UtilIT.enableSetting(SettingsServiceBean.Key.FilePIDsEnabled);
41614162
// Create superuser
41624163
Response createUserResponse = UtilIT.createRandomUser();
41634164
assertEquals(200, createUserResponse.getStatusCode());
@@ -4183,7 +4184,7 @@ public void testDownloadFileWithGuestbookResponseUsingBearerToken() throws IOExc
41834184
JsonObjectBuilder json1 = Json.createObjectBuilder().add("description", "my description1").add("directoryLabel", "data/subdir1").add("categories", Json.createArrayBuilder().add("Data"));
41844185
Response uploadResponse = UtilIT.uploadFileViaNative(datasetId.toString(), "src/main/webapp/resources/images/dataverseproject.png", json1.build(), ownerApiToken);
41854186
uploadResponse.then().assertThat().statusCode(OK.getStatusCode());
4186-
Integer fileId1 = JsonPath.from(uploadResponse.body().asString()).getInt("data.files[0].dataFile.id");
4187+
String filePersistentId = JsonPath.from(uploadResponse.body().asString()).getString("data.files[0].dataFile.persistentId");
41874188

41884189
// Publish dataverse and dataset
41894190
Response publishDataverse = UtilIT.publishDataverseViaNativeApi(dataverseAlias, ownerApiToken);
@@ -4237,7 +4238,7 @@ public void testDownloadFileWithGuestbookResponseUsingBearerToken() throws IOExc
42374238
// POST with guestbook response
42384239
String guestbookResponse = UtilIT.generateGuestbookResponse(guestbook).replace("\"guestbookResponse\": {",
42394240
"\"guestbookResponse\": { \"name\":\"My Name\", \"position\":\"My Position\", \"institution\":\"My Institution\",");
4240-
Response downloadResponse = UtilIT.downloadFilesUrlWithGuestbookResponse(persistentId, null, guestbookResponse, userWithClaimsAccessToken);
4241+
Response downloadResponse = UtilIT.downloadFilesUrlWithGuestbookResponse(filePersistentId,null, guestbookResponse, userWithClaimsAccessToken);
42414242
downloadResponse.prettyPrint();
42424243
downloadResponse.then().assertThat()
42434244
.statusCode(OK.getStatusCode());

0 commit comments

Comments
 (0)