aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2016-11-02 14:57:45 +0100
committerGitHub <noreply@github.com>2016-11-02 14:57:45 +0100
commitffebc050d0492d7fa651e3c369b75881ca189716 (patch)
tree882661471a66f6f0c6a6fcd2db7ae032035406bf /build
parentdada3ffb51ce9d941b15f1e3fdc1ce292acebb69 (diff)
parentea786a35a63fcc85d8487901eeec1f88b6fda078 (diff)
downloadnextcloud-server-ffebc050d0492d7fa651e3c369b75881ca189716.tar.gz
nextcloud-server-ffebc050d0492d7fa651e3c369b75881ca189716.zip
Merge pull request #1887 from nextcloud/downstream-26370
Added functions to check etag of elements - integration tests
Diffstat (limited to 'build')
-rw-r--r--build/integration/features/bootstrap/WebDav.php31
-rw-r--r--build/integration/features/sharing-v1.feature17
2 files changed, 47 insertions, 1 deletions
diff --git a/build/integration/features/bootstrap/WebDav.php b/build/integration/features/bootstrap/WebDav.php
index cdb1fc3fdfd..69962a7282d 100644
--- a/build/integration/features/bootstrap/WebDav.php
+++ b/build/integration/features/bootstrap/WebDav.php
@@ -42,6 +42,8 @@ trait WebDav {
private $davPath = "remote.php/webdav";
/** @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 "([^"]*)"$/
@@ -599,4 +601,33 @@ trait WebDav {
public function asGetsPropertiesOfFileWith($user, $path, $propertiesTable) {
$this->asGetsPropertiesOfFolderWith($user, $path, $propertiesTable);
}
+
+ /**
+ * @Given user :user stores etag of element :path
+ */
+ public function userStoresEtagOfElement($user, $path){
+ $propertiesTable = new \Behat\Gherkin\Node\TableNode([['{DAV:}getetag']]);
+ $this->asGetsPropertiesOfFolderWith($user, $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, $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, $path, $propertiesTable);
+ PHPUnit_Framework_Assert::assertNotEquals($this->response['{DAV:}getetag'], $this->storedETAG[$user][$path]);
+ }
}
diff --git a/build/integration/features/sharing-v1.feature b/build/integration/features/sharing-v1.feature
index 9b19690d6d2..4d913876cc5 100644
--- a/build/integration/features/sharing-v1.feature
+++ b/build/integration/features/sharing-v1.feature
@@ -775,7 +775,7 @@ Feature: sharing
| shareWith | group1 |
When As an "user1"
And Deleting last share
- Then the OCS status code should be "404"
+ Then the OCS status code should be "100"
And the HTTP status code should be "200"
Scenario: Merging shares for recipient when shared from outside with group and member
@@ -952,3 +952,18 @@ Feature: sharing
| shareType | 1 |
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