mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-02 02:11:18 -06:00
[tests-only] test downloading multiple items with archiver
This commit is contained in:
@@ -41,3 +41,23 @@ Feature: download multiple resources bundled into an archive
|
||||
| user-agent | archive-type |
|
||||
| Linux | tar |
|
||||
| Windows NT | zip |
|
||||
|
||||
Scenario: download multiple files and folders
|
||||
Given user "Alice" has uploaded file with content "some data" to "/textfile0.txt"
|
||||
And user "Alice" has uploaded file with content "other data" to "/textfile1.txt"
|
||||
And user "Alice" has created folder "my_data"
|
||||
And user "Alice" has uploaded file with content "some data" to "/my_data/textfile2.txt"
|
||||
And user "Alice" has created folder "more_data"
|
||||
And user "Alice" has uploaded file with content "more data" to "/more_data/an_other_file.txt"
|
||||
When user "Alice" downloads the archive of these items using the resource ids
|
||||
| textfile0.txt |
|
||||
| textfile1.txt |
|
||||
| my_data |
|
||||
| more_data |
|
||||
Then the HTTP status code should be "200"
|
||||
And the downloaded tar archive should contain these files:
|
||||
| name | content |
|
||||
| textfile0.txt | some data |
|
||||
| textfile1.txt | other data |
|
||||
| my_data/textfile2.txt | some data |
|
||||
| more_data/an_other_file.txt | more data |
|
||||
|
||||
@@ -99,6 +99,37 @@ class ArchiverContext implements Context {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :arg1 downloads the archive of these items using the resource ids
|
||||
*
|
||||
* @param string $user
|
||||
* @param TableNode $items
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws \GuzzleHttp\Exception\GuzzleException
|
||||
*/
|
||||
public function userDownloadsTheArchiveOfTheseItemsUsingTheResourceIds(
|
||||
string $user,
|
||||
TableNode $items
|
||||
): void {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$resourceIdsString = '';
|
||||
foreach ($items->getRows() as $item) {
|
||||
$fileId = $this->featureContext->getFileIdForPath($user, $item[0]);
|
||||
$resourceIdsString .= 'id=' . $fileId . '&';
|
||||
}
|
||||
$resourceIdsString = \rtrim($resourceIdsString, '&');
|
||||
$this->featureContext->setResponse(
|
||||
HttpRequestHelper::get(
|
||||
$this->featureContext->getBaseUrl() . '/archiver?' . $resourceIdsString,
|
||||
'',
|
||||
$user,
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the downloaded :type archive should contain these files:
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user