Skip to content

Commit

Permalink
dc.source metadata is not present in the upload section, so we con no…
Browse files Browse the repository at this point in the history
…t apply patch remove request
  • Loading branch information
Micheleboychuk committed May 11, 2020
1 parent 741357e commit 6fbc154
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2422,18 +2422,15 @@ public void patchUploadTest() throws Exception {
is("Description")))
;

// try to remove the description and the source now
// try to remove the description
List<Operation> removeOpts = new ArrayList<Operation>();
removeOpts.add(new RemoveOperation("/sections/upload/files/0/metadata/dc.source/0"));
removeOpts.add(new RemoveOperation("/sections/upload/files/0/metadata/dc.description"));

patchBody = getPatchContent(removeOpts);
getClient(authToken).perform(patch("/api/submission/workspaceitems/" + witem.getID())
.content(patchBody)
.contentType(MediaType.APPLICATION_JSON_PATCH_JSON))
.andExpect(status().isOk())
// check the removed source
.andExpect(jsonPath("$.sections.upload.files[0].metadata['dc.source']").doesNotExist())
// check the filename still here
.andExpect(jsonPath("$.sections.upload.files[0].metadata['dc.title'][0].value",
is("newfilename.pdf")))
Expand All @@ -2444,7 +2441,8 @@ public void patchUploadTest() throws Exception {
// check that changes persist
getClient(authToken).perform(get("/api/submission/workspaceitems/" + witem.getID()))
.andExpect(status().isOk())
.andExpect(jsonPath("$.sections.upload.files[0].metadata['dc.source']").doesNotExist())
.andExpect(jsonPath("$.sections.upload.files[0].metadata['dc.source'][0].value",
is("/local/path/simple-article.pdf")))
.andExpect(jsonPath("$.sections.upload.files[0].metadata['dc.title'][0].value",
is("newfilename.pdf")))
.andExpect(jsonPath("$.sections.upload.files[0].metadata['dc.description']").doesNotExist()) ;
Expand Down

0 comments on commit 6fbc154

Please sign in to comment.