Commit 340b5892 authored by Sergio Bertolin's avatar Sergio Bertolin

Making getShares more reusable

parent 6936f45f
...@@ -512,14 +512,8 @@ trait Sharing { ...@@ -512,14 +512,8 @@ trait Sharing {
} }
} }
/** /* Returns shares of a file or folders as an array of elements */
* @When /^user "([^"]*)" gets shares of (file|folder) "([^"]*)"$/ public function getShares($user, $path) {
* @param string $user
* @param string $type
* @param string $path
* @param \Behat\Gherkin\Node\TableNode|null $body
*/
public function getShares($user, $type, $path, $TableNode){
$fullUrl = $this->baseUrl . "v{$this->apiVersion}.php/apps/files_sharing/api/v{$this->sharingApiVersion}/shares"; $fullUrl = $this->baseUrl . "v{$this->apiVersion}.php/apps/files_sharing/api/v{$this->sharingApiVersion}/shares";
$fullUrl = $fullUrl . '?path=' . $path; $fullUrl = $fullUrl . '?path=' . $path;
...@@ -533,7 +527,18 @@ trait Sharing { ...@@ -533,7 +527,18 @@ trait Sharing {
} }
$this->response = $client->send($client->createRequest("GET", $fullUrl, $options)); $this->response = $client->send($client->createRequest("GET", $fullUrl, $options));
$dataResponded = $this->response->xml()->data->element; return $this->response->xml()->data->element;
}
/**
* @When /^user "([^"]*)" checks public shares of (file|folder) "([^"]*)"$/
* @param string $user
* @param string $type
* @param string $path
* @param \Behat\Gherkin\Node\TableNode|null $body
*/
public function checkPublicShares($user, $type, $path, $TableNode){
$dataResponded = $this->getShares($user, $path);
if ($TableNode instanceof \Behat\Gherkin\Node\TableNode) { if ($TableNode instanceof \Behat\Gherkin\Node\TableNode) {
$elementRows = $TableNode->getRows(); $elementRows = $TableNode->getRows();
......
...@@ -1198,7 +1198,7 @@ Feature: sharing ...@@ -1198,7 +1198,7 @@ Feature: sharing
| permissions | 1 | | permissions | 1 |
Then the OCS status code should be "100" Then the OCS status code should be "100"
And the HTTP status code should be "200" And the HTTP status code should be "200"
And user "user0" gets shares of folder "/FOLDER" And user "user0" checks public shares of folder "/FOLDER"
| /FOLDER | 15 | sharedlink2 | | /FOLDER | 15 | sharedlink2 |
| /FOLDER | 15 | sharedlink1 | | /FOLDER | 15 | sharedlink1 |
| /FOLDER | 1 | sharedlink3 | | /FOLDER | 1 | sharedlink3 |
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment