From 884bc2a8756d5cc68a5640f8e79fb532f1c19f06 Mon Sep 17 00:00:00 2001 From: Prajwol Amatya Date: Mon, 16 Sep 2024 16:40:14 +0545 Subject: [PATCH] added test to create odt file inside deleted parent folder --- .../bootstrap/CollaborationContext.php | 20 ++++++++++++++ .../features/apiCollaboration/wopi.feature | 26 +++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/tests/acceptance/bootstrap/CollaborationContext.php b/tests/acceptance/bootstrap/CollaborationContext.php index 66df330f20f..112093c35ad 100644 --- a/tests/acceptance/bootstrap/CollaborationContext.php +++ b/tests/acceptance/bootstrap/CollaborationContext.php @@ -161,4 +161,24 @@ public function publicCreatesFileInsidePublicFolder(string $file, string $passwo ) ); } + + /** + * @When user :user tries to create a file :file inside deleted folder using wopi endpoint + * + * @param string $user + * @param string $file + * + * @return void + */ + public function userTriesToCreateAFileInsideDeletedFolderInSpaceUsingWopiEndpoint(string $user, string $file): void { + $parent_container_id = $this->featureContext->getStoredFileID(); + $this->featureContext->setResponse( + HttpRequestHelper::post( + $this->featureContext->getBaseUrl() . "/app/new?parent_container_id=$parent_container_id&filename=$file", + $this->featureContext->getStepLineRef(), + $user, + $this->featureContext->getPasswordForUser($user) + ) + ); + } } diff --git a/tests/acceptance/features/apiCollaboration/wopi.feature b/tests/acceptance/features/apiCollaboration/wopi.feature index e93edd9f441..f67b0fdb882 100644 --- a/tests/acceptance/features/apiCollaboration/wopi.feature +++ b/tests/acceptance/features/apiCollaboration/wopi.feature @@ -1056,3 +1056,29 @@ Feature: collaboration (wopi) """ And for user "Alice" folder "testFolder" of the space "new-space" should not contain these files: | simple.odt | + + + Scenario: user tries to create odt file inside not existing parent using wopi endpoint + Given user "Alice" has created folder "testFolder" + And user "Alice" has stored id of folder "testFolder" + And user "Alice" has deleted folder "testFolder" + When user "Alice" tries to create a file "simple.odt" inside deleted folder using wopi endpoint + Then the HTTP status code should be "404" + And the JSON data of the response should match + """ + { + "type": "object", + "required": [ + "code", + "message" + ], + "properties": { + "code": { + "const": "RESOURCE_NOT_FOUND" + }, + "message": { + "const": "the parent container is not accessible or does not exist" + } + } + } + """