Merge pull request #2823 from nextcloud/downstream-integration-tests-adding-report
Downstream integration tests adding report
This commit is contained in:
commit
7130fa7b4c
|
@ -516,13 +516,13 @@ class TagsContext implements \Behat\Behat\Context\Context {
|
|||
}
|
||||
|
||||
/**
|
||||
* @When :taggingUser adds the tag :tagName to :fileName shared by :sharingUser
|
||||
* @When /^"([^"]*)" adds the tag "([^"]*)" to "([^"]*)" (shared|owned) by "([^"]*)"$/
|
||||
* @param string $taggingUser
|
||||
* @param string $tagName
|
||||
* @param string $fileName
|
||||
* @param string $sharingUser
|
||||
*/
|
||||
public function addsTheTagToSharedBy($taggingUser, $tagName, $fileName, $sharingUser) {
|
||||
public function addsTheTagToSharedBy($taggingUser, $tagName, $fileName, $sharedOrOwnedBy, $sharingUser) {
|
||||
$fileId = $this->getFileIdForPath($fileName, $sharingUser);
|
||||
$tagId = $this->findTagIdByName($tagName);
|
||||
|
||||
|
@ -542,13 +542,13 @@ class TagsContext implements \Behat\Behat\Context\Context {
|
|||
}
|
||||
|
||||
/**
|
||||
* @Then :fileName shared by :sharingUser has the following tags
|
||||
* @Then /^"([^"]*)" (shared|owned) by "([^"]*)" has the following tags$/
|
||||
* @param string $fileName
|
||||
* @param string $sharingUser
|
||||
* @param TableNode $table
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function sharedByHasTheFollowingTags($fileName, $sharingUser, TableNode $table) {
|
||||
public function sharedByHasTheFollowingTags($fileName, $sharedOrOwnedBy, $sharingUser, TableNode $table) {
|
||||
$loadedExpectedTags = $table->getTable();
|
||||
$expectedTags = [];
|
||||
foreach($loadedExpectedTags as $expected) {
|
||||
|
|
|
@ -406,6 +406,30 @@ trait WebDav {
|
|||
return $response;
|
||||
}
|
||||
|
||||
/* Returns the elements of a report command
|
||||
* @param string $user
|
||||
* @param string $path
|
||||
* @param string $properties properties which needs to be included in the report
|
||||
* @param string $filterRules filter-rules to choose what needs to appear in the report
|
||||
*/
|
||||
public function reportFolder($user, $path, $properties, $filterRules){
|
||||
$client = $this->getSabreClient($user);
|
||||
|
||||
$body = '<?xml version="1.0" encoding="utf-8" ?>
|
||||
<oc:filter-files xmlns:a="DAV:" xmlns:oc="http://owncloud.org/ns" >
|
||||
<a:prop>
|
||||
' . $properties . '
|
||||
</a:prop>
|
||||
<oc:filter-rules>
|
||||
' . $filterRules . '
|
||||
</oc:filter-rules>
|
||||
</oc:filter-files>';
|
||||
|
||||
$response = $client->request('REPORT', $this->makeSabrePath($user, $path), $body);
|
||||
$parsedResponse = $client->parseMultistatus($response['body']);
|
||||
return $parsedResponse;
|
||||
}
|
||||
|
||||
public function makeSabrePath($user, $path) {
|
||||
return $this->encodePath($this->getDavFilesPath($user) . $path);
|
||||
}
|
||||
|
@ -637,7 +661,6 @@ trait WebDav {
|
|||
$this->asGetsPropertiesOfFolderWith($user, 'entry', $path, $propertiesTable);
|
||||
$pathETAG[$path] = $this->response['{DAV:}getetag'];
|
||||
$this->storedETAG[$user]= $pathETAG;
|
||||
print_r($this->storedETAG[$user][$path]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -681,4 +704,28 @@ trait WebDav {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^user "([^"]*)" in folder "([^"]*)" should have favorited the following elements$/
|
||||
* @param string $user
|
||||
* @param string $folder
|
||||
* @param \Behat\Gherkin\Node\TableNode|null $expectedElements
|
||||
*/
|
||||
public function checkFavoritedElements($user, $folder, $expectedElements){
|
||||
$elementList = $this->reportFolder($user,
|
||||
$folder,
|
||||
'<oc:favorite/>',
|
||||
'<oc:favorite>1</oc:favorite>');
|
||||
if ($expectedElements instanceof \Behat\Gherkin\Node\TableNode) {
|
||||
$elementRows = $expectedElements->getRows();
|
||||
$elementsSimplified = $this->simplifyArray($elementRows);
|
||||
foreach($elementsSimplified as $expectedElement) {
|
||||
$webdavPath = "/" . $this->getDavFilesPath($user) . $expectedElement;
|
||||
if (!array_key_exists($webdavPath,$elementList)){
|
||||
PHPUnit_Framework_Assert::fail("$webdavPath" . " is not in report answer");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -78,3 +78,59 @@ Feature: favorite
|
|||
|{http://owncloud.org/ns}favorite|
|
||||
And the single response should contain a property "{http://owncloud.org/ns}favorite" with value ""
|
||||
|
||||
Scenario: Get favorited elements of a folder
|
||||
Given using old dav path
|
||||
And As an "admin"
|
||||
And user "user0" exists
|
||||
When user "user0" favorites element "/FOLDER"
|
||||
And user "user0" favorites element "/textfile0.txt"
|
||||
And user "user0" favorites element "/textfile1.txt"
|
||||
Then user "user0" in folder "/" should have favorited the following elements
|
||||
| /FOLDER |
|
||||
| /textfile0.txt |
|
||||
| /textfile1.txt |
|
||||
|
||||
Scenario: Get favorited elements of a folder using new path
|
||||
Given using new dav path
|
||||
And As an "admin"
|
||||
And user "user0" exists
|
||||
When user "user0" favorites element "/FOLDER"
|
||||
And user "user0" favorites element "/textfile0.txt"
|
||||
And user "user0" favorites element "/textfile1.txt"
|
||||
Then user "user0" in folder "/" should have favorited the following elements
|
||||
| /FOLDER |
|
||||
| /textfile0.txt |
|
||||
| /textfile1.txt |
|
||||
|
||||
Scenario: Get favorited elements of a subfolder
|
||||
Given using old dav path
|
||||
And As an "admin"
|
||||
And user "user0" exists
|
||||
And user "user0" created a folder "/subfolder"
|
||||
And User "user0" moves file "/textfile0.txt" to "/subfolder/textfile0.txt"
|
||||
And User "user0" moves file "/textfile1.txt" to "/subfolder/textfile1.txt"
|
||||
And User "user0" moves file "/textfile2.txt" to "/subfolder/textfile2.txt"
|
||||
When user "user0" favorites element "/subfolder/textfile0.txt"
|
||||
And user "user0" favorites element "/subfolder/textfile1.txt"
|
||||
And user "user0" favorites element "/subfolder/textfile2.txt"
|
||||
And user "user0" unfavorites element "/subfolder/textfile1.txt"
|
||||
Then user "user0" in folder "/subfolder" should have favorited the following elements
|
||||
| /subfolder/textfile0.txt |
|
||||
| /subfolder/textfile2.txt |
|
||||
|
||||
Scenario: Get favorited elements of a subfolder using new path
|
||||
Given using old dav path
|
||||
And As an "admin"
|
||||
And user "user0" exists
|
||||
And user "user0" created a folder "/subfolder"
|
||||
And User "user0" moves file "/textfile0.txt" to "/subfolder/textfile0.txt"
|
||||
And User "user0" moves file "/textfile1.txt" to "/subfolder/textfile1.txt"
|
||||
And User "user0" moves file "/textfile2.txt" to "/subfolder/textfile2.txt"
|
||||
When user "user0" favorites element "/subfolder/textfile0.txt"
|
||||
And user "user0" favorites element "/subfolder/textfile1.txt"
|
||||
And user "user0" favorites element "/subfolder/textfile2.txt"
|
||||
And user "user0" unfavorites element "/subfolder/textfile1.txt"
|
||||
Then user "user0" in folder "/subfolder" should have favorited the following elements
|
||||
| /subfolder/textfile0.txt |
|
||||
| /subfolder/textfile2.txt |
|
||||
|
||||
|
|
|
@ -425,3 +425,12 @@ Feature: tags
|
|||
Then The response should have a status code "201"
|
||||
And the user "user0" cannot assign the "not user-assignable" tag with name "TagWithGroups"
|
||||
|
||||
Scenario: Assign a normal tag to a file
|
||||
Given user "user0" exists
|
||||
And "admin" creates a "normal" tag with name "Etiqueta"
|
||||
And As an "user0"
|
||||
When "user0" adds the tag "Etiqueta" to "/textfile0.txt" owned by "user0"
|
||||
Then The response should have a status code "201"
|
||||
And "textfile0.txt" owned by "user0" has the following tags
|
||||
| Etiqueta |
|
||||
|
||||
|
|
Loading…
Reference in New Issue