Merge pull request #5232 from owncloud/add-api-tests-public-link-folder-download
[tests-only][full-ci]Add api tests public link folder download
This commit is contained in:
4 files changed
+78
-1
No files matched your search
@@ -73,7 +73,8 @@ default:
|
||||
- WebDavPropertiesContext:
|
||||
- TUSContext:
|
||||
- SpacesTUSContext:
|
||||
|
||||
- ArchiverContext:
|
||||
|
||||
apiContract:
|
||||
paths:
|
||||
- '%paths.base%/../features/apiContract'
|
||||
|
||||
@@ -87,3 +87,6 @@ The expected failures in this file are from features in the owncloud/ocis repo.
|
||||
- [apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature:160](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature#L160)
|
||||
- [apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature:161](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature#L161)
|
||||
- [apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature:162](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature#L162)
|
||||
|
||||
#### [Public cannot download folder via the public link of the folder inside the project space](https://github.com/owncloud/ocis/issues/5229)
|
||||
- [apiSpacesShares/publicLinkDownload.feature:30](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/publicLinkDownload.feature#L30)
|
||||
@@ -0,0 +1,43 @@
|
||||
@api @skipOnOcV10
|
||||
Feature: Public can download folders from project space public link
|
||||
As a public
|
||||
I want to be able to download folder from public link
|
||||
So that I can gain access to it's contents
|
||||
|
||||
Background:
|
||||
Given these users have been created with default attributes and without skeleton files:
|
||||
| username |
|
||||
| Alice |
|
||||
| Brian |
|
||||
And using spaces DAV path
|
||||
And the administrator has given "Alice" the role "Space Admin" using the settings api
|
||||
And user "Alice" has created a space "new-space" with the default quota using the GraphApi
|
||||
|
||||
|
||||
Scenario: download a folder from public link of a space
|
||||
Given user "Alice" has created a folder "NewFolder" in space "new-space"
|
||||
And user "Alice" has uploaded a file inside space "new-space" with content "some content" to "NewFolder/test.txt"
|
||||
And user "Alice" has created a public link share of the space "new-space" with settings:
|
||||
| permissions | 1 |
|
||||
| name | someName |
|
||||
When public downloads the folder "NewFolder" from the last created public link using the public files API
|
||||
Then the HTTP status code should be "200"
|
||||
And the downloaded tar archive should contain these files:
|
||||
| name | content |
|
||||
| NewFolder/test.txt | some content |
|
||||
|
||||
@issue-5229
|
||||
Scenario: download a folder from public link of a folder inside a space
|
||||
Given user "Alice" has created a folder "NewFolder" in space "new-space"
|
||||
And user "Alice" has created a folder "NewFolder/folder" in space "new-space"
|
||||
And user "Alice" has uploaded a file inside space "new-space" with content "some content" to "NewFolder/folder/test.txt"
|
||||
And user "Alice" has created a public link share inside of space "new-space" with settings:
|
||||
| path | NewFolder |
|
||||
| shareType | 3 |
|
||||
| permissions | 1 |
|
||||
| name | public link |
|
||||
When public downloads the folder "folder" from the last created public link using the public files API
|
||||
Then the HTTP status code should be "200"
|
||||
And the downloaded tar archive should contain these files:
|
||||
| name | content |
|
||||
| folder/test.txt | some content |
|
||||
@@ -73,6 +73,7 @@ class SpacesContext implements Context {
|
||||
* @var FilesVersionsContext
|
||||
*/
|
||||
private FilesVersionsContext $filesVersionsContext;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
@@ -3028,4 +3029,33 @@ class SpacesContext implements Context {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^public downloads the folder "([^"]*)" from the last created public link using the public files API$/
|
||||
*
|
||||
* @param string $resource
|
||||
*
|
||||
* @return void
|
||||
* @throws GuzzleException|JsonException
|
||||
*/
|
||||
public function publicDownloadsTheFolderFromTheLastCreatedPublicLink(string $resource) {
|
||||
$token = $this->featureContext->getLastPublicShareToken();
|
||||
$response = $this->featureContext->listFolderAndReturnResponseXml(
|
||||
$token,
|
||||
$resource,
|
||||
'0',
|
||||
['oc:fileid'],
|
||||
$this->featureContext->getDavPathVersion() === 1 ? "public-files" : "public-files-new"
|
||||
);
|
||||
$resourceId = json_decode(json_encode($response->xpath("//d:response/d:propstat/d:prop/oc:fileid")), true, 512, JSON_THROW_ON_ERROR);
|
||||
$queryString = 'public-token=' . $token . '&id=' . $resourceId[0][0];
|
||||
$this->featureContext->setResponse(
|
||||
HttpRequestHelper::get(
|
||||
$this->featureContext->getBaseUrl() . '/archiver?' . $queryString,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user