Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 29 additions & 9 deletions tests/acceptance/features/bootstrap/Provisioning.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,12 +296,16 @@ public function userHasBeenCreatedWithDefaultAttributes($user) {
* @return void
*/
public function userHasBeenCreatedWithDefaultAttributesAndWithoutSkeletonFiles($user) {
$path = $this->popSkeletonDirectoryConfig();
$baseUrl = $this->getBaseUrl();
$path = $this->popSkeletonDirectoryConfig($baseUrl);
try {
$this->userHasBeenCreatedWithDefaultAttributes($user);
} finally {
// restore skeletondirectory even if user creation failed
$this->runOcc(["config:system:set skeletondirectory --value $path"]);
$this->runOcc(
["config:system:set skeletondirectory --value $path"],
null, null, $baseUrl
);
}
}

Expand All @@ -315,14 +319,18 @@ public function userHasBeenCreatedWithDefaultAttributesAndWithoutSkeletonFiles($
* @return void
*/
public function theseUsersHaveBeenCreatedWithDefaultAttributesAndWithoutSkeletonFiles(TableNode $table) {
$path = $this->popSkeletonDirectoryConfig();
$baseUrl = $this->getBaseUrl();
$path = $this->popSkeletonDirectoryConfig($baseUrl);
try {
foreach ($table as $row) {
$this->userHasBeenCreatedWithDefaultAttributes($row['username']);
}
} finally {
// restore skeletondirectory even if user creation failed
$this->runOcc(["config:system:set skeletondirectory --value $path"]);
$this->runOcc(
["config:system:set skeletondirectory --value $path"],
null, null, $baseUrl
);
}
}

Expand All @@ -337,12 +345,16 @@ public function theseUsersHaveBeenCreatedWithDefaultAttributesAndWithoutSkeleton
* @return void
*/
public function theseUsersHaveBeenCreatedWithoutSkeletonFiles(TableNode $table) {
$path = $this->popSkeletonDirectoryConfig();
$baseUrl = $this->getBaseUrl();
$path = $this->popSkeletonDirectoryConfig($baseUrl);
try {
$this->theseUsersHaveBeenCreated("", "", $table);
} finally {
// restore skeletondirectory even if user creation failed
$this->runOcc(["config:system:set skeletondirectory --value $path"]);
$this->runOcc(
["config:system:set skeletondirectory --value $path"],
null, null, $baseUrl
);
}
}

Expand Down Expand Up @@ -3069,12 +3081,20 @@ public function getDisabledApps() {
/**
* Removes skeleton directory config from config.php and returns the config value
*
* @param string $baseUrl
*
* @return string
*/
public function popSkeletonDirectoryConfig() {
$this->runOcc(["config:system:get skeletondirectory"]);
public function popSkeletonDirectoryConfig($baseUrl) {
$this->runOcc(
["config:system:get skeletondirectory"],
null, null, $baseUrl
);
$path = \trim($this->getStdOutOfOccCommand());
$this->runOcc(["config:system:delete skeletondirectory"]);
$this->runOcc(
["config:system:delete skeletondirectory"],
null, null, $baseUrl
);
return $path;
}
}
15 changes: 8 additions & 7 deletions tests/acceptance/features/bootstrap/WebDav.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,16 @@ trait WebDav {
private $customDavPath = null;

private $oldAsyncSetting = null;

private $oldDavSlowdownSetting = null;

/**
* response content parsed from XML to an array
*
* @var array
*/
private $responseXml = [];

/**
* response content parsed into a SimpleXMLElement
*
Expand Down Expand Up @@ -1089,7 +1089,7 @@ public function listFolder(
if ($this->customDavPath !== null) {
$path = $this->customDavPath . $path;
}

return WebDavHelper::listFolder(
$this->getBaseUrl(),
$this->getActualUsername($user),
Expand Down Expand Up @@ -1198,6 +1198,7 @@ public function theUserUploadsAFileTo($source, $destination) {
}

/**
* @Given /^user "([^"]*)" on "(LOCAL|REMOTE)" has uploaded file "([^"]*)" to "([^"]*)"$/
* @When /^user "([^"]*)" on "(LOCAL|REMOTE)" uploads file "([^"]*)" to "([^"]*)" using the WebDAV API$/
*
* @param string $user
Expand Down Expand Up @@ -1323,7 +1324,7 @@ public function userUploadsAFileAsyncToWithChunks(
$user, $source, $destination, $noOfChunks, $chunkingVersion, true
);
}

/**
* sets the chunking version from human readable format
*
Expand Down Expand Up @@ -2100,7 +2101,7 @@ public function headersShouldMatchRegularExpressions(TableNode $table) {
$expectedHeaderValue = $this->substituteInLineCodes(
$expectedHeaderValue, ['preg_quote' => ['/'] ]
);

$returnedHeader = $this->response->getHeader($headerName);
PHPUnit\Framework\Assert::assertNotFalse(
(bool)\preg_match($expectedHeaderValue, $returnedHeader),
Expand Down Expand Up @@ -2205,7 +2206,7 @@ public function propfindResultShouldContainEntries(
) {
$elementRows = $expectedFiles->getRows();
$should = ($shouldOrNot !== "not");

foreach ($elementRows as $expectedFile) {
$fileFound = $this->findEntryFromPropfindResponse(
$expectedFile[0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,17 @@ Feature: Federation Sharing - sharing with users on other cloud storages

Background:
Given using server "REMOTE"
And user "user1" has been created with default attributes and skeleton files
And user "user1" has been created with default attributes and without skeleton files
And user "user1" has created folder "simple-folder"
And user "user1" has created folder "simple-empty-folder"
And user "user1" has uploaded file with content "I am lorem.txt inside simple-folder" to "/simple-folder/lorem.txt"
And user "user1" has uploaded file "filesForUpload/lorem.txt" to "/lorem.txt"
And using server "LOCAL"
And user "user1" has been created with default attributes and skeleton files
And user "user1" has been created with default attributes and without skeleton files
And user "user1" has created folder "simple-folder"
And user "user1" has created folder "simple-empty-folder"
And user "user1" has uploaded file with content "I am lorem.txt inside simple-folder" to "/simple-folder/lorem.txt"
And user "user1" has uploaded file "filesForUpload/lorem.txt" to "/lorem.txt"
And user "user1" has logged in using the webUI
And parameter "auto_accept_trusted" of app "federatedfilesharing" has been set to "no"

Expand All @@ -24,10 +32,12 @@ Feature: Federation Sharing - sharing with users on other cloud storages

Scenario: test the single steps of receiving a federation share
Given using server "REMOTE"
And these users have been created with default attributes and skeleton files:
And these users have been created with default attributes and without skeleton files:
| username |
| user2 |
| user3 |
And user "user2" has created folder "simple-empty-folder"
And user "user3" has uploaded file with content "I am lorem.txt" to "/lorem.txt"
And user "user1" from server "REMOTE" has shared "simple-folder" with user "user1" from server "LOCAL"
And user "user2" from server "REMOTE" has shared "simple-empty-folder" with user "user1" from server "LOCAL"
And user "user3" from server "REMOTE" has shared "lorem.txt" with user "user1" from server "LOCAL"
Expand All @@ -39,10 +49,10 @@ Feature: Federation Sharing - sharing with users on other cloud storages
| Remote share | Do you want to add the remote share /lorem.txt from user3@%remote_server_without_scheme%? |
When the user accepts the offered remote shares using the webUI
Then file "lorem (2).txt" should be listed on the webUI
And the content of "lorem (2).txt" on the local server should be the same as the original "lorem.txt"
And the content of file "lorem (2).txt" for user "user1" on server "LOCAL" should be "I am lorem.txt"
And folder "simple-folder (2)" should be listed on the webUI
And file "lorem.txt" should be listed in folder "simple-folder (2)" on the webUI
And the content of "lorem.txt" on the local server should be the same as the original "simple-folder/lorem.txt"
And the content of file "simple-folder (2)/lorem.txt" for user "user1" on server "LOCAL" should be "I am lorem.txt inside simple-folder"
And file "lorem (2).txt" should be listed in the shared-with-you page on the webUI
And folder "simple-folder (2)" should be listed in the shared-with-you page on the webUI
And folder "simple-empty-folder (2)" should be listed in the shared-with-you page on the webUI
Expand Down Expand Up @@ -79,7 +89,8 @@ Feature: Federation Sharing - sharing with users on other cloud storages
| /lorem%20(2).txt |

Scenario: one user disabling user-based auto accepting while global is enabled has no effect on other users
Given user "user2" has been created with default attributes and skeleton files
Given user "user2" has been created with default attributes and without skeleton files
And user "user2" has uploaded file "filesForUpload/lorem.txt" to "/lorem.txt"
And parameter "autoAddServers" of app "federation" has been set to "1"
And user "user1" from server "REMOTE" has shared "simple-folder" with user "user1" from server "LOCAL"
And user "user1" from server "LOCAL" has accepted the last pending share
Expand Down Expand Up @@ -175,36 +186,38 @@ Feature: Federation Sharing - sharing with users on other cloud storages
Scenario: rename a file in a received share - local server shares - remote server receives
Given user "user1" from server "LOCAL" has shared "simple-folder" with user "user1" from server "REMOTE"
And user "user1" from server "REMOTE" has accepted the last pending share
When user "user1" on "REMOTE" moves file "/simple-folder%20(2)/lorem-big.txt" to "/simple-folder%20(2)/renamed%20file.txt" using the WebDAV API
When user "user1" on "REMOTE" moves file "/simple-folder%20(2)/lorem.txt" to "/simple-folder%20(2)/renamed%20file.txt" using the WebDAV API
And user "user1" re-logs in to "%local_server%" using the webUI
And the user opens folder "simple-folder" using the webUI
Then file "renamed file.txt" should be listed on the webUI
But file "lorem-big.txt" should not be listed on the webUI
And the content of "renamed file.txt" on the local server should be the same as the original "simple-folder/lorem-big.txt"
But file "lorem.txt" should not be listed on the webUI
And the content of file "simple-folder/renamed file.txt" for user "user1" on server "LOCAL" should be "I am lorem.txt inside simple-folder"

@skipOnFIREFOX
Scenario: rename a file in a received share - remote server shares - local server receives
Given user "user1" from server "REMOTE" has shared "simple-folder" with user "user1" from server "LOCAL"
And the user has reloaded the current page of the webUI
When the user accepts the offered remote shares using the webUI
When the user opens folder "simple-folder (2)" using the webUI
And the user renames file "lorem-big.txt" to "renamed file.txt" using the webUI
And the user renames file "lorem.txt" to "renamed file.txt" using the webUI
And user "user1" re-logs in to "%remote_server%" using the webUI
And the user opens folder "simple-folder" using the webUI
Then file "renamed file.txt" should be listed on the webUI
And the content of "renamed file.txt" on the remote server should be the same as the original "simple-folder/lorem-big.txt"
But file "lorem-big.txt" should not be listed on the webUI
And the content of file "simple-folder/renamed file.txt" for user "user1" on server "REMOTE" should be "I am lorem.txt inside simple-folder"
But file "lorem.txt" should not be listed on the webUI

Scenario: delete a file in a received share - local server shares - remote server receives
Given user "user1" from server "LOCAL" has shared "simple-folder" with user "user1" from server "REMOTE"
Given user "user1" has uploaded file "filesForUpload/data.zip" to "/simple-folder/data.zip"
And user "user1" from server "LOCAL" has shared "simple-folder" with user "user1" from server "REMOTE"
And user "user1" from server "REMOTE" has accepted the last pending share
When user "user1" on "REMOTE" deletes file "simple-folder (2)/data.zip" using the WebDAV API
And user "user1" re-logs in to "%local_server%" using the webUI
And the user opens folder "simple-folder" using the webUI
Then file "data.zip" should not be listed on the webUI

Scenario: delete a file in a received share - remote server shares - local server receives
Given user "user1" from server "REMOTE" has shared "simple-folder" with user "user1" from server "LOCAL"
Given user "user1" on "REMOTE" has uploaded file "filesForUpload/data.zip" to "/simple-folder/data.zip"
And user "user1" from server "REMOTE" has shared "simple-folder" with user "user1" from server "LOCAL"
And the user has reloaded the current page of the webUI
When the user accepts the offered remote shares using the webUI
And the user opens folder "simple-folder (2)" using the webUI
Expand All @@ -215,7 +228,8 @@ Feature: Federation Sharing - sharing with users on other cloud storages

Scenario: receive same name federation share from two users
Given using server "REMOTE"
And user "user2" has been created with default attributes and skeleton files
And user "user2" has been created with default attributes and without skeleton files
And user "user2" has uploaded file "filesForUpload/lorem.txt" to "/lorem.txt"
And user "user1" from server "REMOTE" has shared "/lorem.txt" with user "user1" from server "LOCAL"
And user "user2" from server "REMOTE" has shared "/lorem.txt" with user "user1" from server "LOCAL"
And the user has reloaded the current page of the webUI
Expand Down Expand Up @@ -245,9 +259,8 @@ Feature: Federation Sharing - sharing with users on other cloud storages

Scenario: test sharing folder to a remote server and resharing it back to the local
Given using server "LOCAL"
And these users have been created with skeleton files:
| username |
| user2 |
And user "user2" has been created with default attributes and without skeleton files
And user "user2" has created folder "simple-folder"
When the user shares folder "simple-folder" with remote user "user1@%remote_server_without_scheme%" using the webUI
And user "user1" re-logs in to "%remote_server%" using the webUI
And the user accepts the offered remote shares using the webUI
Expand All @@ -259,9 +272,8 @@ Feature: Federation Sharing - sharing with users on other cloud storages

Scenario: test resharing folder as readonly and set it as readonly by resharer
Given using server "LOCAL"
And these users have been created with skeleton files:
| username |
| user2 |
And user "user2" has been created with default attributes and without skeleton files
And user "user2" has created folder "simple-folder"
When the user shares folder "simple-folder" with remote user "user1@%remote_server_without_scheme%" using the webUI
And user "user1" re-logs in to "%remote_server%" using the webUI
And the user accepts the offered remote shares using the webUI
Expand All @@ -277,9 +289,8 @@ Feature: Federation Sharing - sharing with users on other cloud storages

Scenario: test resharing folder and set it as readonly by owner
Given using server "LOCAL"
And these users have been created with skeleton files:
| username |
| user2 |
And user "user2" has been created with default attributes and without skeleton files
And user "user2" has created folder "simple-folder"
When the user shares folder "simple-folder" with remote user "user1@%remote_server_without_scheme%" using the webUI
And user "user1" re-logs in to "%remote_server%" using the webUI
And the user accepts the offered remote shares using the webUI
Expand All @@ -305,7 +316,8 @@ Feature: Federation Sharing - sharing with users on other cloud storages
Then as "user1" file "/averylongfilenamefortestingthatfileswithlongfilenamescannotbeshared.txt" should exist

Scenario: sharee should be able to access the files/folders inside other folder
Given user "user1" has created folder "simple-folder/simple-empty-folder/finalfolder"
Given user "user1" has created folder "simple-folder/simple-empty-folder"
And user "user1" has created folder "simple-folder/simple-empty-folder/finalfolder"
And user "user1" has uploaded file "filesForUpload/textfile.txt" to "/simple-folder/simple-empty-folder/textfile.txt"
And user "user1" from server "LOCAL" has shared "simple-folder" with user "user1" from server "REMOTE"
And user "user1" from server "REMOTE" has accepted the last pending share
Expand All @@ -317,7 +329,8 @@ Feature: Federation Sharing - sharing with users on other cloud storages
And folder "finalfolder" should be listed on the webUI

Scenario: sharee uploads a file inside a folder of a folder
Given user "user1" from server "LOCAL" has shared "simple-folder" with user "user1" from server "REMOTE"
Given user "user1" has created folder "simple-folder/simple-empty-folder"
And user "user1" from server "LOCAL" has shared "simple-folder" with user "user1" from server "REMOTE"
And user "user1" from server "REMOTE" has accepted the last pending share
When user "user1" re-logs in to "%remote_server%" using the webUI
And the user opens folder "simple-folder (2)/simple-empty-folder" using the webUI
Expand All @@ -327,7 +340,8 @@ Feature: Federation Sharing - sharing with users on other cloud storages

@skipOnFIREFOX
Scenario: rename a file in a folder inside a shared folder
Given user "user1" has uploaded file "filesForUpload/textfile.txt" to "/simple-folder/simple-empty-folder/textfile.txt"
Given user "user1" has created folder "simple-folder/simple-empty-folder"
And user "user1" has uploaded file "filesForUpload/textfile.txt" to "/simple-folder/simple-empty-folder/textfile.txt"
And user "user1" from server "LOCAL" has shared "simple-folder" with user "user1" from server "REMOTE"
And user "user1" from server "REMOTE" has accepted the last pending share
And user "user1" re-logs in to "%remote_server%" using the webUI
Expand All @@ -338,7 +352,8 @@ Feature: Federation Sharing - sharing with users on other cloud storages
But as "user1" file "simple-folder/simple-empty-folder/textfile.txt" should not exist

Scenario: delete a file in a folder inside a shared folder
Given user "user1" has uploaded file "filesForUpload/textfile.txt" to "/simple-folder/simple-empty-folder/textfile.txt"
Given user "user1" has created folder "simple-folder/simple-empty-folder"
And user "user1" has uploaded file "filesForUpload/textfile.txt" to "/simple-folder/simple-empty-folder/textfile.txt"
And user "user1" from server "LOCAL" has shared "simple-folder" with user "user1" from server "REMOTE"
And user "user1" from server "REMOTE" has accepted the last pending share
And user "user1" re-logs in to "%remote_server%" using the webUI
Expand Down