Skip to content

Commit

Permalink
Merge pull request #8858 from IQSS/6846-tests
Browse files Browse the repository at this point in the history
add sleep in FilesIT, clean up assertions #6846
  • Loading branch information
kcondon committed Jul 27, 2022
2 parents 8814194 + f5f35fd commit 38c7976
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/test/java/edu/harvard/iq/dataverse/api/FilesIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -650,14 +650,18 @@ public void testForceReplaceAndUpdate() {
//"junk" passed below is to test that it is discarded
String updateJsonString = "{\"description\":\""+updateDescription+"\",\"categories\":[\""+updateCategory+"\"],\"forceReplace\":false ,\"junk\":\"junk\"}";
Response updateMetadataFailResponse = UtilIT.updateFileMetadata(origFileId.toString(), updateJsonString, apiToken);
assertEquals(BAD_REQUEST.getStatusCode(), updateMetadataFailResponse.getStatusCode());

updateMetadataFailResponse.prettyPrint();
updateMetadataFailResponse.then().assertThat().statusCode(BAD_REQUEST.getStatusCode());

UtilIT.sleepForLock(datasetId, null, apiToken, UtilIT.MAXIMUM_INGEST_LOCK_DURATION);

//Adding an additional fileMetadata update tests after this to ensure updating replaced files works
msg("Update file metadata for new file");
//"junk" passed below is to test that it is discarded
System.out.print("params: " + String.valueOf(newDfId) + " " + updateJsonString + " " + apiToken);
Response updateMetadataResponse = UtilIT.updateFileMetadata(String.valueOf(newDfId), updateJsonString, apiToken);
assertEquals(OK.getStatusCode(), updateMetadataResponse.getStatusCode());
updateMetadataResponse.prettyPrint();
updateMetadataResponse.then().assertThat().statusCode(OK.getStatusCode());
//String updateMetadataResponseString = updateMetadataResponse.body().asString();
Response getUpdatedMetadataResponse = UtilIT.getDataFileMetadataDraft(newDfId, apiToken);
String getUpMetadataResponseString = getUpdatedMetadataResponse.body().asString();
Expand Down

0 comments on commit 38c7976

Please sign in to comment.