added test to create odt file inside deleted parent folder

This commit is contained in:
Prajwol Amatya
2024-09-17 10:02:02 +05:45
parent e0495932fa
commit 02288eaad2
2 changed files with 49 additions and 0 deletions

View File

@@ -205,4 +205,27 @@ class CollaborationContext implements Context {
)
);
}
/**
* @When user :user tries to create a file :file inside deleted folder using wopi endpoint
*
* @param string $user
* @param string $file
*
* @return void
* @throws GuzzleException
*/
public function userTriesToCreateAFileInsideDeletedFolderUsingWopiEndpoint(string $user, string $file): void {
$parentContainerId = $this->featureContext->getStoredFileID();
$this->featureContext->setResponse(
CollaborationHelper::createFile(
$this->featureContext->getBaseUrl(),
$this->featureContext->getStepLineRef(),
$user,
$this->featureContext->getPasswordForUser($user),
$parentContainerId,
$file
)
);
}
}

View File

@@ -986,3 +986,29 @@ Feature: collaboration (wopi)
}
"""
And as "Alice" file "publicFolder/simple.odt" should not exist
Scenario: user tries to create odt file inside deleted parent folder 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"
}
}
}
"""