Skip to content

Commit

Permalink
Fix delete test
Browse files Browse the repository at this point in the history
Signed-off-by: Ayoub LABIDI <[email protected]>
  • Loading branch information
ayolab committed Dec 16, 2024
1 parent 2e5013a commit 359952d
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,14 @@ public MockResponse dispatch(RecordedRequest request) {
return new MockResponse(204);
} else if (path.matches(SPREADSHEET_CONFIG_COLLECTION_SERVER_BASE_URL + "/duplicate\\?duplicateFrom=" + COLLECTION_UUID) && "POST".equals(request.getMethod())) {
return new MockResponse(201, Headers.of("Content-Type", "application/json"), objectMapper.writeValueAsString(UUID.randomUUID()));
} else if (path.matches("/v1/directories/.*/elements\\?allowNewName=.*") && "POST".equals(request.getMethod())) {
} else if ((path.matches("/v1/directories/.*/elements\\?allowNewName=.*") && "POST".equals(request.getMethod())) || path.matches("/v1/elements/" + COLLECTION_UUID)) {
ElementAttributes elementAttributes = new ElementAttributes(COLLECTION_UUID, COLLECTION_NAME, "SPREADSHEET_CONFIG_COLLECTION", USER_ID, 0L, null);
return new MockResponse(200, Headers.of("Content-Type", "application/json"), objectMapper.writeValueAsString(elementAttributes));
} else if (path.matches("/v1/elements\\?duplicateFrom=.*&newElementUuid=.*")) {
ElementAttributes duplicatedElement = new ElementAttributes(UUID.randomUUID(), COLLECTION_NAME + " (copy)", "SPREADSHEET_CONFIG_COLLECTION", USER_ID, 0L, null);
return new MockResponse(200, Headers.of("Content-Type", "application/json"), objectMapper.writeValueAsString(duplicatedElement));
} else if (path.matches("/v1/elements\\?forDeletion=true&ids=.*")) {
return new MockResponse(200);
} else if (path.matches("/v1/elements/" + COLLECTION_UUID)) {
return new MockResponse(200);
}
return new MockResponse(404);
}
Expand Down

0 comments on commit 359952d

Please sign in to comment.