Skip to content

Commit

Permalink
added test to create odt file inside deleted parent folder
Browse files Browse the repository at this point in the history
  • Loading branch information
PrajwolAmatya committed Sep 16, 2024
1 parent e52e30e commit 884bc2a
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/acceptance/bootstrap/CollaborationContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)
);
}
}
26 changes: 26 additions & 0 deletions tests/acceptance/features/apiCollaboration/wopi.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
"""

0 comments on commit 884bc2a

Please sign in to comment.