mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-04-13 11:57:33 -04:00
Merge pull request #9960 from owncloud/create-text-file
[tests-only][full-ci]added test to create text file with `/app/new` endpoint
This commit is contained in:
@@ -96,4 +96,27 @@ class CollaborationContext implements Context {
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user creates a file :file inside folder :folder in space :space using wopi endpoint
|
||||
* @When user :user tries to create a file :file inside folder :folder in space :space using wopi endpoint
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $file
|
||||
* @param string $folder
|
||||
* @param string $space
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function userCreatesFileInsideFolderInSpaceUsingWopiEndpoint(string $user, string $file, string $folder, string $space): void {
|
||||
$parent_container_id = $this->spacesContext->getResourceId($user, $space, $folder);
|
||||
$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)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -552,3 +552,189 @@ Feature: collaboration (wopi)
|
||||
| app-endpoint |
|
||||
| /app/open-with-web?file_id=<<FILEID>>&app_name=FakeOffice |
|
||||
| /app/open-with-web?file_id=<<FILEID>> |
|
||||
|
||||
|
||||
Scenario: create a text file using wopi endpoint in Personal space
|
||||
Given user "Alice" has created folder "testFolder"
|
||||
When user "Alice" creates a file "testfile.txt" inside folder "testFolder" in space "Personal" using wopi endpoint
|
||||
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 as "Alice" file "testFolder/testfile.txt" should exist
|
||||
|
||||
|
||||
Scenario Outline: sharee with permission Editor/Uploader creates text file inside shared folder
|
||||
Given user "Alice" has created folder "testFolder"
|
||||
And user "Alice" has sent the following resource share invitation:
|
||||
| resource | testFolder |
|
||||
| space | Personal |
|
||||
| sharee | Brian |
|
||||
| shareType | user |
|
||||
| permissionsRole | <permissions-role> |
|
||||
When user "Brian" creates a file "testFile.txt" inside folder "testFolder" in space "Shares" using wopi endpoint
|
||||
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 as "Alice" file "testFolder/testFile.txt" should exist
|
||||
And as "Brian" file "Shares/testFolder/testFile.txt" should exist
|
||||
Examples:
|
||||
| permissions-role |
|
||||
| Editor |
|
||||
| Uploader |
|
||||
|
||||
|
||||
Scenario: sharee with permission Viewer tries to create text file inside shared folder
|
||||
Given user "Alice" has created folder "testFolder"
|
||||
And user "Alice" has sent the following resource share invitation:
|
||||
| resource | testFolder |
|
||||
| space | Personal |
|
||||
| sharee | Brian |
|
||||
| shareType | user |
|
||||
| permissionsRole | Viewer |
|
||||
When user "Brian" tries to create a file "testFile.txt" inside folder "testFolder" in space "Shares" using wopi endpoint
|
||||
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 as "Alice" file "testFolder/testFile.txt" should not exist
|
||||
And as "Brian" file "Shares/testFolder/testFile.txt" should not exist
|
||||
|
||||
|
||||
Scenario: space admin creates a text file in project space using wopi endpoint
|
||||
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"
|
||||
When user "Alice" creates a file "testFile.txt" inside folder "testFolder" in space "new-space" using wopi endpoint
|
||||
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:
|
||||
| testFile.txt |
|
||||
|
||||
|
||||
Scenario Outline: user with Space Editor/Manager role creates a text file inside shared project space using wopi endpoint
|
||||
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 sent the following space share invitation:
|
||||
| space | new-space |
|
||||
| sharee | Brian |
|
||||
| shareType | user |
|
||||
| permissionsRole | <permissions-role> |
|
||||
When user "Brian" creates a file "testFile.txt" inside folder "testFolder" in space "new-space" using wopi endpoint
|
||||
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:
|
||||
| testFile.txt |
|
||||
And for user "Brian" folder "testFolder" of the space "new-space" should contain these files:
|
||||
| testFile.txt |
|
||||
Examples:
|
||||
| permissions-role |
|
||||
| Space Editor |
|
||||
| Manager |
|
||||
|
||||
|
||||
Scenario: user with Viewer role tries to create a text file inside shared project space using wopi endpoint
|
||||
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 sent the following space share invitation:
|
||||
| space | new-space |
|
||||
| sharee | Brian |
|
||||
| shareType | user |
|
||||
| permissionsRole | Space Viewer |
|
||||
When user "Brian" tries to create a file "testFile.txt" inside folder "testFolder" in space "new-space" using wopi endpoint
|
||||
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:
|
||||
| testFile.txt |
|
||||
And for user "Brian" folder "testFolder" of the space "new-space" should not contain these files:
|
||||
| testFile.txt |
|
||||
|
||||
Reference in New Issue
Block a user