Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orphaned shares test and some requirements #25977

Merged
merged 2 commits into from
Sep 22, 2016
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
31 changes: 31 additions & 0 deletions build/integration/features/bootstrap/BasicStructure.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,27 @@ public function sendingToWith($verb, $url, $body) {
}
}

public function sendingToWithDirectUrl($verb, $url, $body) {
$fullUrl = substr($this->baseUrl, 0, -5) . $url;
$client = new Client();
$options = [];
if ($this->currentUser === 'admin') {
$options['auth'] = $this->adminUser;
} else {
$options['auth'] = [$this->currentUser, $this->regularUser];
}
if ($body instanceof \Behat\Gherkin\Node\TableNode) {
$fd = $body->getRowsHash();
$options['body'] = $fd;
}

try {
$this->response = $client->send($client->createRequest($verb, $fullUrl, $options));
} catch (\GuzzleHttp\Exception\ClientException $ex) {
$this->response = $ex->getResponse();
}
}

public function isExpectedUrl($possibleUrl, $finalPart){
$baseUrlChopped = substr($this->baseUrl, 0, -4);
$endCharacter = strlen($baseUrlChopped) + strlen($finalPart);
Expand Down Expand Up @@ -271,6 +292,16 @@ public function modifyTextOfFile($user, $filename, $text) {
file_put_contents("../../data/$user/files" . "$filename", "$text");
}

/**
* @When User :user empties trashbin
* @param string $user
*/
public function emptyTrashbin($user) {
$body = new \Behat\Gherkin\Node\TableNode([['allfiles', 'true'], ['dir', '%2F']]);
$this->sendingToWithDirectUrl('POST', "/index.php/apps/files_trashbin/ajax/delete.php", $body);
$this->theHTTPStatusCodeShouldBe('200');
}

/**
* @BeforeSuite
*/
Expand Down
5 changes: 3 additions & 2 deletions build/integration/features/bootstrap/WebDav.php
Original file line number Diff line number Diff line change
Expand Up @@ -415,11 +415,12 @@ public function userUploadsAFileWithContentTo($user, $content, $destination)
}

/**
* @When User :user deletes file :file
* @When /^User "([^"]*)" deletes (file|folder) "([^"]*)"$/
* @param string $user
* @param string $type
* @param string $file
*/
public function userDeletesFile($user, $file) {
public function userDeletesFile($user, $type, $file) {
try {
$this->response = $this->makeDavRequest($user, 'DELETE', $file, []);
} catch (\GuzzleHttp\Exception\ServerException $e) {
Expand Down
18 changes: 18 additions & 0 deletions build/integration/features/sharing-v1.feature
Original file line number Diff line number Diff line change
Expand Up @@ -868,3 +868,21 @@ Feature: sharing
And the single response should contain a property "{http://owncloud.org/ns}permissions" with value "SRDNVCK"
And as "user1" the folder "merge-test-outside-groups-renamebeforesecondshare" does not exist

Scenario: Empting trashbin
Given As an "admin"
And user "user0" exists
And User "user0" deletes file "/textfile0.txt"
When User "user0" empties trashbin
Then the HTTP status code should be "200"

Scenario: orphaned shares
Given As an "admin"
And user "user0" exists
And user "user1" exists
And user "user0" created a folder "/common"
And user "user0" created a folder "/common/sub"
And file "/common/sub" of user "user0" is shared with user "user1"
And User "user0" deletes folder "/common"
When User "user0" empties trashbin
Then as "user1" the folder "sub" does not exist