Commit 6109a19a authored by Sergio Bertolín's avatar Sergio Bertolín Committed by GitHub
Browse files

Merge pull request #26370 from owncloud/integration_tests_adding_etag_support

Added functions to check etag of elements
parents 371d191e dff0c25d
......@@ -16,6 +16,8 @@ trait WebDav {
private $usingOldDavPath = true;
/** @var ResponseInterface */
private $response;
/** @var map with user as key and another map as value, which has path as key and etag as value */
private $storedETAG = NULL;
/**
* @Given /^using dav path "([^"]*)"$/
......@@ -585,4 +587,33 @@ trait WebDav {
return $response;
}
/**
* @Given user :user stores etag of element :path
*/
public function userStoresEtagOfElement($user, $path){
$propertiesTable = new \Behat\Gherkin\Node\TableNode([['{DAV:}getetag']]);
$this->asGetsPropertiesOfFolderWith($user, NULL, $path, $propertiesTable);
$pathETAG[$path] = $this->response['{DAV:}getetag'];
$this->storedETAG[$user]= $pathETAG;
print_r($this->storedETAG[$user][$path]);
}
/**
* @Then etag of element :path of user :user has not changed
*/
public function checkIfETAGHasNotChanged($path, $user){
$propertiesTable = new \Behat\Gherkin\Node\TableNode([['{DAV:}getetag']]);
$this->asGetsPropertiesOfFolderWith($user, NULL, $path, $propertiesTable);
PHPUnit_Framework_Assert::assertEquals($this->response['{DAV:}getetag'], $this->storedETAG[$user][$path]);
}
/**
* @Then etag of element :path of user :user has changed
*/
public function checkIfETAGHasChanged($path, $user){
$propertiesTable = new \Behat\Gherkin\Node\TableNode([['{DAV:}getetag']]);
$this->asGetsPropertiesOfFolderWith($user, NULL, $path, $propertiesTable);
PHPUnit_Framework_Assert::assertNotEquals($this->response['{DAV:}getetag'], $this->storedETAG[$user][$path]);
}
}
......@@ -901,3 +901,18 @@ Feature: sharing
Then the OCS status code should be "100"
And the HTTP status code should be "200"
Scenario: unshare from self
Given As an "admin"
And user "user0" exists
And user "user1" exists
And group "sharing-group" exists
And user "user0" belongs to group "sharing-group"
And user "user1" belongs to group "sharing-group"
And file "/PARENT/parent.txt" of user "user0" is shared with group "sharing-group"
And user "user0" stores etag of element "/PARENT"
And user "user1" stores etag of element "/"
And As an "user1"
When Deleting last share
Then etag of element "/" of user "user1" has changed
And etag of element "/PARENT" of user "user0" has not changed
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