Skip to content
Snippets Groups Projects
Unverified Commit 39a56c7b authored by David Toledo's avatar David Toledo Committed by Thomas Müller
Browse files

Added favorites integration tests

parent 5de64324
No related branches found
No related tags found
No related merge requests found
...@@ -434,5 +434,43 @@ trait WebDav { ...@@ -434,5 +434,43 @@ trait WebDav {
$this->response = $ex->getResponse(); $this->response = $ex->getResponse();
} }
} }
}
/*
* @When user "([^"]*)" favorites folder "([^"]*)"
* @param string $user
* @param string $path
* @param \Behat\Gherkin\Node\TableNode|null $propertiesTable
*/
public function userFavoritesFolder($user, $path, $propertiesTable) {
$properties = null;
if ($propertiesTable instanceof \Behat\Gherkin\Node\TableNode) {
foreach ($propertiesTable->getRows() as $row) {
$properties[] = $row[0];
}
}
$this->response = $this->favFolder($user, $path, 0, $properties);
}
/*Set the elements of a proppatch, $folderDepth requires 1 to see elements without children*/
public function favFolder($user, $path, $folderDepth, $properties = null){
$fullUrl = substr($this->baseUrl, 0, -4);
$settings = array(
'baseUri' => $fullUrl,
'userName' => $user,
);
if ($user === 'admin') {
$settings['password'] = $this->adminUser[1];
} else {
$settings['password'] = $this->regularUser;
}
$client = new SClient($settings);
if (!$properties) {
$properties = [
'{http://owncloud.org/ns}favorite'
];
}
echo $properties,
$response = $client->proppatch($this->davPath . '/' . ltrim($path, '/'), $properties, $folderDepth);
return $response;
}
}
Feature: favorite
Background:
Given using api version "1"
Scenario: Retrieving favorite info of a folder
Given using dav path "remote.php/webdav"
And As an "admin"
And user "user0" exists
When user "user0" favorites folder "/"
|{http://owncloud.org/ns}favorite|
Then As "user0" gets properties of folder "/" with
|{http://owncloud.org/ns}favorite|
And the single response should contain a property "{http://owncloud.org/ns}favorite" with value "1"
Scenario: Retrieving favorite info of a file
Given using dav path "remote.php/webdav"
And As an "admin"
And user "user0" exists
When user "user0" favorites folder "/textfile0.txt"
|{http://owncloud.org/ns}favorite|
Then As "user0" gets properties of folder "/textfile0.txt" with
|{http://owncloud.org/ns}favorite|
And the single response should contain a property "{http://owncloud.org/ns}favorite" with value "1"
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment