Skip to content

Commit

Permalink
added test for public user to create file in public space
Browse files Browse the repository at this point in the history
  • Loading branch information
PrajwolAmatya committed Sep 16, 2024
1 parent e9c1ad3 commit e52e30e
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/acceptance/bootstrap/CollaborationContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,19 @@ public function userCreatesFileInsideFolderInSpaceUsingWopiEndpoint(string $user
/**
* @When public creates a file :file inside public folder with password :password
* @When public tries to create a file :file inside public folder with password :password
* @When public creates a file :file inside folder :folder in public space with password :password
* @When public tries to create a file :file inside folder :folder in public space with password :password
*
* @param string $file
* @param string $password
* @param string|null $folder
*
* @return void
*/
public function publicCreatesFileInsidePublicFolder(string $file, string $password): void {
public function publicCreatesFileInsidePublicFolder(string $file, string $password, string $folder = null): void {
$token = $this->featureContext->shareNgGetLastCreatedLinkShareToken();
$response = HttpRequestHelper::sendRequest(
$this->featureContext->getBaseUrl() . "/remote.php/dav/public-files/$token",
$this->featureContext->getBaseUrl() . "/remote.php/dav/public-files/$token/$folder",
$this->featureContext->getStepLineRef(),
"PROPFIND",
"public",
Expand Down
68 changes: 68 additions & 0 deletions tests/acceptance/features/apiCollaboration/wopi.feature
Original file line number Diff line number Diff line change
Expand Up @@ -988,3 +988,71 @@ Feature: collaboration (wopi)
}
"""
And as "Alice" file "publicFolder/simple.odt" should not exist

@issue-8691
Scenario Outline: public user creates .odt file in public space
Given using spaces DAV path
And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
And user "Alice" has created a space "new-space" with the default quota using the Graph API
And user "Alice" has created a folder "testFolder" in space "new-space"
And user "Alice" has created the following space link share:
| space | new-space |
| permissionsRole | <permissions-role> |
| password | %public% |
When public creates a file "simple.odt" inside folder "testFolder" in public space with password "%public%"
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
{
"type": "object",
"required": [
"file_id"
],
"properties": {
"file_id": {
"type": "string",
"pattern": "^%file_id_pattern%$"
}
}
}
"""
And for user "Alice" folder "testFolder" of the space "new-space" should contain these files:
| simple.odt |
Examples:
| permissions-role |
| edit |
| upload |
| createOnly |

@issue-8691
Scenario: public user creates .odt file in public space
Given using spaces DAV path
And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
And user "Alice" has created a space "new-space" with the default quota using the Graph API
And user "Alice" has created a folder "testFolder" in space "new-space"
And user "Alice" has created the following space link share:
| space | new-space |
| permissionsRole | view |
| password | %public% |
When public tries to create a file "simple.odt" inside folder "testFolder" in public space with password "%public%"
Then the HTTP status code should be "500"
And the JSON data of the response should match
"""
{
"type": "object",
"required": [
"code",
"message"
],
"properties": {
"code": {
"const": "SERVER_ERROR"
},
"message": {
"const": "error calling InitiateFileUpload"
}
}
}
"""
And for user "Alice" folder "testFolder" of the space "new-space" should not contain these files:
| simple.odt |

0 comments on commit e52e30e

Please sign in to comment.