Merge pull request #9713 from owncloud/tests/update-expected-failure-list

[tests-only][ful-ci] adjust tests and expected failure list
This commit is contained in:
Sawjan Gurung
2024-08-02 10:07:12 +05:45
committed by GitHub
9 changed files with 372 additions and 149 deletions
+22 -13
View File
@@ -130,7 +130,7 @@ class WebDavHelper {
if (\is_int($namespaceString)) { if (\is_int($namespaceString)) {
//default namespace prefix if the property has no array key //default namespace prefix if the property has no array key
//also used if no prefix is given in the property value //also used if no prefix is given in the property value
$namespacePrefix = "d"; $namespacePrefix = null;
} else { } else {
//calculate the namespace prefix and namespace from the array key //calculate the namespace prefix and namespace from the array key
$matches = []; $matches = [];
@@ -145,7 +145,12 @@ class WebDavHelper {
$namespacePrefix = $propertyParts[0]; $namespacePrefix = $propertyParts[0];
$property = $propertyParts[1]; $property = $propertyParts[1];
} }
$propertyBody .= "<$namespacePrefix:$property/>";
if ($namespacePrefix) {
$propertyBody .= "<$namespacePrefix:$property/>";
} else {
$propertyBody .= "<$property/>";
}
} }
$body = "<?xml version=\"1.0\"?> $body = "<?xml version=\"1.0\"?>
<d:propfind <d:propfind
@@ -253,18 +258,22 @@ class WebDavHelper {
?string $propertyName, ?string $propertyName,
?string $propertyValue, ?string $propertyValue,
?string $xRequestId = '', ?string $xRequestId = '',
?string $namespaceString = "oc='http://owncloud.org/ns'", ?string $namespaceString = null,
?int $davPathVersionToUse = self::DAV_VERSION_NEW, ?int $davPathVersionToUse = self::DAV_VERSION_NEW,
?string $type="files" ?string $type="files"
):ResponseInterface { ):ResponseInterface {
$matches = []; if ($namespaceString !== null) {
\preg_match("/^(.*)='(.*)'$/", $namespaceString, $matches); $matches = [];
$namespace = $matches[2]; \preg_match("/^(.*)='(.*)'$/", $namespaceString, $matches);
$namespacePrefix = $matches[1]; $namespace = $matches[2];
$propertyBody = "<$namespacePrefix:$propertyName" . $namespacePrefix = $matches[1];
" xmlns:$namespacePrefix=\"$namespace\">" . $propertyBody = "<$namespacePrefix:$propertyName" .
"$propertyValue" . " xmlns:$namespacePrefix=\"$namespace\">" .
"</$namespacePrefix:$propertyName>"; "$propertyValue" .
"</$namespacePrefix:$propertyName>";
} else {
$propertyBody = "<$propertyName>$propertyValue</$propertyName>";
}
$body = "<?xml version=\"1.0\"?> $body = "<?xml version=\"1.0\"?>
<d:propertyupdate xmlns:d=\"DAV:\" <d:propertyupdate xmlns:d=\"DAV:\"
xmlns:oc=\"http://owncloud.org/ns\"> xmlns:oc=\"http://owncloud.org/ns\">
@@ -409,7 +418,7 @@ class WebDavHelper {
):ResponseInterface { ):ResponseInterface {
if (!$properties) { if (!$properties) {
$properties = [ $properties = [
'getetag', 'resourcetype' 'd:getetag', 'd:resourcetype'
]; ];
} }
return self::propfind( return self::propfind(
@@ -931,7 +940,7 @@ class WebDavHelper {
$user, $user,
$password, $password,
$resource, $resource,
["getlastmodified"], ["d:getlastmodified"],
$xRequestId, $xRequestId,
"0", "0",
"files", "files",
@@ -6,21 +6,23 @@ The expected failures in this file are from features in the owncloud/ocis repo.
Basic file management like up and download, move, copy, properties, trash, versions and chunking. Basic file management like up and download, move, copy, properties, trash, versions and chunking.
#### [copy personal space file to shared folder root result share in decline state](https://github.com/owncloud/ocis/issues/6999) #### [COPY a folder to received share file/folder seems to work but no change in shares](https://github.com/owncloud/ocis/issues/6999)
- [coreApiWebdavProperties/copyFile.feature:261](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L261) - [coreApiWebdavProperties/copyFile.feature:284](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L284)
- [coreApiWebdavProperties/copyFile.feature:262](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L262) - [coreApiWebdavProperties/copyFile.feature:285](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L285)
- [coreApiWebdavProperties/copyFile.feature:308](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L308)
- [coreApiWebdavProperties/copyFile.feature:309](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L309)
- [coreApiWebdavProperties/copyFile.feature:482](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L482)
- [coreApiWebdavProperties/copyFile.feature:483](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L483)
- [coreApiWebdavProperties/copyFile.feature:484](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L484)
#### [Custom dav properties with namespaces are rendered incorrectly](https://github.com/owncloud/ocis/issues/2140) #### [Custom dav properties with namespaces are rendered incorrectly](https://github.com/owncloud/ocis/issues/2140)
_ocdav: double-check the webdav property parsing when custom namespaces are used_ _ocdav: double-check the webdav property parsing when custom namespaces are used_
- [coreApiWebdavProperties/setFileProperties.feature:32](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/setFileProperties.feature#L32) - [coreApiWebdavProperties/setFileProperties.feature:128](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/setFileProperties.feature#L128)
- [coreApiWebdavProperties/setFileProperties.feature:33](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/setFileProperties.feature#L33) - [coreApiWebdavProperties/setFileProperties.feature:129](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/setFileProperties.feature#L129)
- [coreApiWebdavProperties/setFileProperties.feature:34](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/setFileProperties.feature#L34) - [coreApiWebdavProperties/setFileProperties.feature:130](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/setFileProperties.feature#L130)
- [coreApiWebdavProperties/setFileProperties.feature:69](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/setFileProperties.feature#L69)
- [coreApiWebdavProperties/setFileProperties.feature:67](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/setFileProperties.feature#L67)
- [coreApiWebdavProperties/setFileProperties.feature:68](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/setFileProperties.feature#L68)
#### [Cannot set custom webDav properties](https://github.com/owncloud/product/issues/264) #### [Cannot set custom webDav properties](https://github.com/owncloud/product/issues/264)
@@ -190,14 +192,11 @@ And other missing implementation of favorites
#### [copying the file inside Shares folder returns 412](https://github.com/owncloud/ocis/issues/3874) #### [copying the file inside Shares folder returns 412](https://github.com/owncloud/ocis/issues/3874)
- [coreApiWebdavProperties/copyFile.feature:408](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L408)
- [coreApiWebdavProperties/copyFile.feature:409](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L409)
- [coreApiWebdavProperties/copyFile.feature:410](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L410)
- [coreApiWebdavProperties/copyFile.feature:435](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L435)
- [coreApiWebdavProperties/copyFile.feature:436](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L436)
- [coreApiWebdavProperties/copyFile.feature:437](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L437)
- [coreApiWebdavProperties/copyFile.feature:238](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L238) - [coreApiWebdavProperties/copyFile.feature:238](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L238)
- [coreApiWebdavProperties/copyFile.feature:239](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L239) - [coreApiWebdavProperties/copyFile.feature:239](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L239)
- [coreApiWebdavProperties/copyFile.feature:455](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L455)
- [coreApiWebdavProperties/copyFile.feature:456](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L456)
- [coreApiWebdavProperties/copyFile.feature:457](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L457)
### Won't fix ### Won't fix
@@ -192,33 +192,6 @@ class FavoritesContext implements Context {
$this->asUserFileOrFolderShouldBeFavorited($user, $path, 0); $this->asUserFileOrFolderShouldBeFavorited($user, $path, 0);
} }
/**
* @Then /^as the user (?:file|folder|entry) "([^"]*)" should be favorited$/
*
* @param string $path
* @param integer $expectedValue 0|1
*
* @return void
*/
public function asTheUserFileOrFolderShouldBeFavorited(string $path, int $expectedValue = 1):void {
$this->asUserFileOrFolderShouldBeFavorited(
$this->featureContext->getCurrentUser(),
$path,
$expectedValue
);
}
/**
* @Then /^as the user (?:file|folder|entry) "([^"]*)" should not be favorited$/
*
* @param string $path
*
* @return void
*/
public function asTheUserFileOrFolderShouldNotBeFavorited(string $path):void {
$this->asTheUserFileOrFolderShouldBeFavorited($path, 0);
}
/** /**
* Set the elements of a proppatch * Set the elements of a proppatch
* *
@@ -315,7 +315,7 @@ class FilesVersionsContext implements Context {
$user = $this->featureContext->getActualUsername($user); $user = $this->featureContext->getActualUsername($user);
$fileId = $this->featureContext->getFileIdForPath($user, $path); $fileId = $this->featureContext->getFileIdForPath($user, $path);
Assert::assertNotNull($fileId, __METHOD__ . " fileid of file $path user $user not found (the file may not exist)"); Assert::assertNotNull($fileId, __METHOD__ . " fileid of file $path user $user not found (the file may not exist)");
$response = $this->listVersionFolder($user, $fileId, 1, ['getcontentlength']); $response = $this->listVersionFolder($user, $fileId, 1, ['d:getcontentlength']);
$responseXml = HttpRequestHelper::getResponseXml( $responseXml = HttpRequestHelper::getResponseXml(
$response, $response,
__METHOD__ __METHOD__
@@ -504,7 +504,7 @@ class FilesVersionsContext implements Context {
):ResponseInterface { ):ResponseInterface {
if (!$properties) { if (!$properties) {
$properties = [ $properties = [
'getetag' 'd:getetag'
]; ];
} }
$user = $this->featureContext->getActualUsername($user); $user = $this->featureContext->getActualUsername($user);
+17 -3
View File
@@ -946,7 +946,7 @@ trait WebDav {
* @return void * @return void
*/ */
public function downloadedContentShouldBe(string $content):void { public function downloadedContentShouldBe(string $content):void {
$this->checkDownloadedContentMatches($content); $this->checkDownloadedContentMatches($content, '', $this->getResponse());
} }
/** /**
@@ -986,7 +986,21 @@ trait WebDav {
* @return void * @return void
*/ */
public function theContentInTheResponseShouldMatchTheFollowingContent(PyStringNode $content): void { public function theContentInTheResponseShouldMatchTheFollowingContent(PyStringNode $content): void {
$this->checkDownloadedContentMatches($content->getRaw()); $this->checkDownloadedContentMatches($content->getRaw(), '', $this->getResponse());
}
/**
* @Then the content in the response should include the following content:
*
* @param PyStringNode $content
*
* @return void
*/
public function theContentInTheResponseShouldIncludeTheFollowingContent(PyStringNode $content): void {
Assert::assertStringContainsString(
$content->getRaw(),
(string) $this->response->getBody()
);
} }
/** /**
@@ -1024,7 +1038,7 @@ trait WebDav {
public function checkStatusCodeForDownloadedContentShouldBe(int $statusCode, string $content):void { public function checkStatusCodeForDownloadedContentShouldBe(int $statusCode, string $content):void {
$actualStatusCode = $this->response->getStatusCode(); $actualStatusCode = $this->response->getStatusCode();
if ($actualStatusCode === $statusCode) { if ($actualStatusCode === $statusCode) {
$this->checkDownloadedContentMatches($content); $this->checkDownloadedContentMatches($content, '', $this->getResponse());
} }
} }
@@ -42,6 +42,18 @@ class WebDavPropertiesContext implements Context {
*/ */
private array $storedETAG = []; private array $storedETAG = [];
/**
* @param string $namespaceString
*
* @return object
*/
public function parseNamespace(string $namespaceString): object {
//calculate the namespace prefix and namespace
$matches = [];
\preg_match("/^(.*)='(.*)'$/", $namespaceString, $matches);
return (object)["namespace" => $matches[2], "prefix" => $matches[1]];
}
/** /**
* @When /^user "([^"]*)" gets the properties of (?:file|folder|entry) "([^"]*)" using the WebDAV API$/ * @When /^user "([^"]*)" gets the properties of (?:file|folder|entry) "([^"]*)" using the WebDAV API$/
* *
@@ -183,6 +195,37 @@ class WebDavPropertiesContext implements Context {
$this->featureContext->theHTTPStatusCodeShouldBe(207, "", $response); $this->featureContext->theHTTPStatusCodeShouldBe(207, "", $response);
} }
/**
* @When user :user gets a custom property :propertyName of file :path
*
* @param string $user
* @param string $propertyName
* @param string $path
*
* @return void
* @throws Exception
*/
public function userGetsCustomPropertyOfFile(
string $user,
string $propertyName,
string $path
):void {
$user = $this->featureContext->getActualUsername($user);
$properties = [$propertyName];
$response = WebDavHelper::propfind(
$this->featureContext->getBaseUrl(),
$this->featureContext->getActualUsername($user),
$this->featureContext->getUserPassword($user),
$path,
$properties,
$this->featureContext->getStepLineRef(),
"0",
"files",
$this->featureContext->getDavPathVersion()
);
$this->featureContext->setResponse($response);
}
/** /**
* @When user :user gets a custom property :propertyName with namespace :namespace of file :path * @When user :user gets a custom property :propertyName with namespace :namespace of file :path
* *
@@ -194,7 +237,7 @@ class WebDavPropertiesContext implements Context {
* @return void * @return void
* @throws Exception * @throws Exception
*/ */
public function userGetsPropertiesOfFile( public function userGetsPropertiesWithNamespaceOfFile(
string $user, string $user,
string $propertyName, string $propertyName,
string $namespace, string $namespace,
@@ -204,19 +247,18 @@ class WebDavPropertiesContext implements Context {
$properties = [ $properties = [
$namespace => $propertyName $namespace => $propertyName
]; ];
$this->featureContext->setResponse( $response = WebDavHelper::propfind(
WebDavHelper::propfind( $this->featureContext->getBaseUrl(),
$this->featureContext->getBaseUrl(), $this->featureContext->getActualUsername($user),
$this->featureContext->getActualUsername($user), $this->featureContext->getUserPassword($user),
$this->featureContext->getUserPassword($user), $path,
$path, $properties,
$properties, $this->featureContext->getStepLineRef(),
$this->featureContext->getStepLineRef(), "0",
"0", "files",
"files", $this->featureContext->getDavPathVersion()
$this->featureContext->getDavPathVersion()
)
); );
$this->featureContext->setResponse($response);
} }
/** /**
@@ -258,19 +300,19 @@ class WebDavPropertiesContext implements Context {
/** /**
* @param string $user user id who sets the property * @param string $user user id who sets the property
* @param string $propertyName name of property in Clark notation * @param string $propertyName name of property in Clark notation
* @param string $namespace namespace in the form of "x1='http://whatever.org/ns'"
* @param string $path path on which to set properties to * @param string $path path on which to set properties to
* @param string $propertyValue property value * @param string $propertyValue property value
* @param string|null $namespace namespace in the form of "x1='http://whatever.org/ns'"
* *
* @return ResponseInterface * @return ResponseInterface
* @throws Exception * @throws Exception
*/ */
public function setPropertyWithNamespaceOfResource( public function setResourceProperty(
string $user, string $user,
string $propertyName, string $propertyName,
string $namespace,
string $path, string $path,
string $propertyValue string $propertyValue,
string $namespace = null,
):ResponseInterface { ):ResponseInterface {
$user = $this->featureContext->getActualUsername($user); $user = $this->featureContext->getActualUsername($user);
return WebDavHelper::proppatch( return WebDavHelper::proppatch(
@@ -287,7 +329,33 @@ class WebDavPropertiesContext implements Context {
} }
/** /**
* @When /^user "([^"]*)" sets property "([^"]*)" with namespace "([^"]*)" of (?:file|folder|entry) "([^"]*)" to "([^"]*)" using the WebDAV API$/ * @Given /^user "([^"]*)" sets property "([^"]*)" of (?:file|folder|entry) "([^"]*)" to "([^"]*)"$/
*
* @param string $user user id who sets the property
* @param string $propertyName name of property in Clark notation
* @param string $path path on which to set properties to
* @param string $propertyValue property value
*
* @return void
* @throws Exception
*/
public function userSetsPropertyOfEntryTo(
string $user,
string $propertyName,
string $path,
string $propertyValue
):void {
$response = $this->setResourceProperty(
$user,
$propertyName,
$path,
$propertyValue
);
$this->featureContext->setResponse($response);
}
/**
* @When /^user "([^"]*)" sets property "([^"]*)" with namespace "([^"]*)" of (?:file|folder|entry) "([^"]*)" to "([^"]*)" using the WebDAV API$/
* *
* @param string $user user id who sets the property * @param string $user user id who sets the property
* @param string $propertyName name of property in Clark notation * @param string $propertyName name of property in Clark notation
@@ -305,14 +373,40 @@ class WebDavPropertiesContext implements Context {
string $path, string $path,
string $propertyValue string $propertyValue
):void { ):void {
$response = $this->setPropertyWithNamespaceOfResource( $response = $this->setResourceProperty(
$user,
$propertyName,
$path,
$propertyValue,
$namespace
);
$this->featureContext->setResponse($response);
}
/**
* @Given /^user "([^"]*)" has set property "([^"]*)" of (?:file|folder|entry) "([^"]*)" to "([^"]*)"$/
*
* @param string $user user id who sets the property
* @param string $propertyName name of property in Clark notation
* @param string $path path on which to set properties to
* @param string $propertyValue property value
*
* @return void
* @throws Exception
*/
public function userHasSetPropertyOfEntryTo(
string $user,
string $propertyName,
string $path,
string $propertyValue
):void {
$response = $this->setResourceProperty(
$user, $user,
$propertyName, $propertyName,
$namespace,
$path, $path,
$propertyValue $propertyValue
); );
$this->featureContext->setResponse($response); $this->featureContext->theHTTPStatusCodeShouldBe(207, "", $response);
} }
/** /**
@@ -334,46 +428,33 @@ class WebDavPropertiesContext implements Context {
string $path, string $path,
string $propertyValue string $propertyValue
):void { ):void {
$response = $this->setPropertyWithNamespaceOfResource( $response = $this->setResourceProperty(
$user, $user,
$propertyName, $propertyName,
$namespace,
$path, $path,
$propertyValue $propertyValue,
$namespace
); );
$this->featureContext->theHTTPStatusCodeShouldBe(207, "", $response); $this->featureContext->theHTTPStatusCodeShouldBe(207, "", $response);
} }
/** /**
* @Then /^the response should contain a custom "([^"]*)" property with namespace "([^"]*)" and value "([^"]*)"$/ * @Then /^the response should contain a custom "([^"]*)" property with value "(([^"\\]|\\.)*)"$/
* *
* @param string $propertyName * @param string $propertyName
* @param string $namespaceString
* @param string $propertyValue * @param string $propertyValue
* *
* @return void * @return void
* @throws Exception * @throws Exception
*/ */
public function theResponseShouldContainACustomPropertyWithValue( public function theResponseShouldContainCustomPropertyWithValue(string $propertyName, string $propertyValue): void {
string $propertyName, $propertyValue = \str_replace('\"', '"', $propertyValue);
string $namespaceString,
string $propertyValue
):void {
$responseXmlObject = $this->featureContext->getResponseXml( $responseXmlObject = $this->featureContext->getResponseXml(
$this->featureContext->getResponse(), $this->featureContext->getResponse(),
__METHOD__ __METHOD__
); );
//calculate the namespace prefix and namespace
$matches = [];
\preg_match("/^(.*)='(.*)'$/", $namespaceString, $matches);
$nameSpace = $matches[2];
$nameSpacePrefix = $matches[1];
$responseXmlObject->registerXPathNamespace(
$nameSpacePrefix,
$nameSpace
);
$xmlPart = $responseXmlObject->xpath( $xmlPart = $responseXmlObject->xpath(
"//d:prop/" . "$nameSpacePrefix:$propertyName" "//d:prop/" . "$propertyName"
); );
Assert::assertArrayHasKey( Assert::assertArrayHasKey(
0, 0,
@@ -389,7 +470,7 @@ class WebDavPropertiesContext implements Context {
} }
/** /**
* @Then /^the response should contain a custom "([^"]*)" property with namespace "([^"]*)" and complex value "(([^"\\]|\\.)*)"$/ * @Then /^the response should contain a custom "([^"]*)" property with namespace "([^"]*)" and value "([^"]*)"$/
* *
* @param string $propertyName * @param string $propertyName
* @param string $namespaceString * @param string $namespaceString
@@ -398,7 +479,7 @@ class WebDavPropertiesContext implements Context {
* @return void * @return void
* @throws Exception * @throws Exception
*/ */
public function theResponseShouldContainACustomPropertyWithComplexValue( public function theResponseShouldContainACustomPropertyWithNamespaceAndValue(
string $propertyName, string $propertyName,
string $namespaceString, string $namespaceString,
string $propertyValue string $propertyValue
@@ -409,17 +490,13 @@ class WebDavPropertiesContext implements Context {
$this->featureContext->getResponse(), $this->featureContext->getResponse(),
__METHOD__ __METHOD__
); );
//calculate the namespace prefix and namespace $ns = $this->parseNamespace($namespaceString);
$matches = [];
\preg_match("/^(.*)='(.*)'$/", $namespaceString, $matches);
$nameSpace = $matches[2];
$nameSpacePrefix = $matches[1];
$responseXmlObject->registerXPathNamespace( $responseXmlObject->registerXPathNamespace(
$nameSpacePrefix, $ns->prefix,
$nameSpace $ns->namespace
); );
$xmlPart = $responseXmlObject->xpath( $xmlPart = $responseXmlObject->xpath(
"//d:prop/" . "$nameSpacePrefix:$propertyName" . "/*" "//d:prop/$propertyName"
); );
Assert::assertArrayHasKey( Assert::assertArrayHasKey(
0, 0,
@@ -428,9 +505,9 @@ class WebDavPropertiesContext implements Context {
); );
Assert::assertEquals( Assert::assertEquals(
$propertyValue, $propertyValue,
$xmlPart[0]->asXML(), $xmlPart[0]->__toString(),
"\"$propertyName\" has a value \"" . "\"$propertyName\" has a value \"" .
$xmlPart[0]->asXML() . "\" but \"$propertyValue\" expected" $xmlPart[0]->__toString() . "\" but \"$propertyValue\" expected"
); );
} }
@@ -457,6 +534,38 @@ class WebDavPropertiesContext implements Context {
); );
} }
/**
* @Then the xml response should contain a property :key
*
* @param string $key
*
* @return void
* @throws Exception
*/
public function theResponseShouldContainProperty(string $key): void {
$this->checkResponseContainsProperty(
$this->featureContext->getResponse(),
$key
);
}
/**
* @Then the xml response should contain a property :key with namespace :namespace
*
* @param string $key
* @param string $namespace
*
* @return void
* @throws Exception
*/
public function theResponseShouldContainPropertyWithNamespace(string $key, string $namespace): void {
$this->checkResponseContainsProperty(
$this->featureContext->getResponse(),
$key,
$namespace
);
}
/** /**
* @Then the single response should contain a property :key with value :value * @Then the single response should contain a property :key with value :value
* *
@@ -525,6 +634,41 @@ class WebDavPropertiesContext implements Context {
); );
} }
/**
* @param ResponseInterface $response
* @param string $key
* @param string|null $namespaceString
*
* @return SimpleXMLElement
* @throws Exception
*/
public function checkResponseContainsProperty(ResponseInterface $response, string $key, string $namespaceString = null): SimpleXMLElement {
$xmlPart = $this->featureContext->getResponseXml($response);
if ($namespaceString !== null) {
$ns = $this->parseNamespace($namespaceString);
$xmlPart->registerXPathNamespace(
$ns->prefix,
$ns->namespace
);
}
$match = $xmlPart->xpath("//d:prop/$key");
Assert::assertTrue(
isset($match[0]),
"Cannot find property \"$key\""
);
$property = \explode(":", $key);
$propertyName = $property[\count($property) - 1];
Assert::assertEquals(
$match[0]->getName(),
$propertyName
);
return $match[0];
}
/** /**
* @param ResponseInterface $response * @param ResponseInterface $response
* @param string $key * @param string $key
@@ -542,15 +686,8 @@ class WebDavPropertiesContext implements Context {
string $altExpectedValue, string $altExpectedValue,
?string $user = null ?string $user = null
):void { ):void {
$xmlPart = $this->featureContext->getResponseXml($response); $xmlPart = $this->checkResponseContainsProperty($response, $key);
$xmlPart = $xmlPart->xpath( $value = $xmlPart->__toString();
"//d:prop/$key"
);
Assert::assertTrue(
isset($xmlPart[0]),
"Cannot find property \"$key\""
);
$value = $xmlPart[0]->__toString();
$expectedValue = $this->featureContext->substituteInLineCodes( $expectedValue = $this->featureContext->substituteInLineCodes(
$expectedValue, $expectedValue,
$user $user
@@ -1040,7 +1177,7 @@ class WebDavPropertiesContext implements Context {
$storePath = $path; $storePath = $path;
} }
$user = $this->featureContext->getActualUsername($user); $user = $this->featureContext->getActualUsername($user);
$propertiesTable = new TableNode([['propertyName'],['getetag']]); $propertiesTable = new TableNode([['propertyName'],['d:getetag']]);
$response = $this->getPropertiesOfFolder( $response = $this->getPropertiesOfFolder(
$user, $user,
$path, $path,
@@ -1186,7 +1323,7 @@ class WebDavPropertiesContext implements Context {
*/ */
public function getCurrentEtagOfElement(string $path, string $user):string { public function getCurrentEtagOfElement(string $path, string $user):string {
$user = $this->featureContext->getActualUsername($user); $user = $this->featureContext->getActualUsername($user);
$propertiesTable = new TableNode([['propertyName'],['getetag']]); $propertiesTable = new TableNode([['propertyName'],['d:getetag']]);
$response = $this->getPropertiesOfFolder( $response = $this->getPropertiesOfFolder(
$user, $user,
$path, $path,
@@ -30,7 +30,7 @@ Feature: using trashbin together with sharing
| new | | new |
| spaces | | spaces |
@issue-7555 @issue-1224 @issue-7555
Scenario Outline: deleting a file in a received folder moves it to trashbin of both users Scenario Outline: deleting a file in a received folder moves it to trashbin of both users
Given using <dav-path-version> DAV path Given using <dav-path-version> DAV path
And user "Brian" has been created with default attributes and without skeleton files And user "Brian" has been created with default attributes and without skeleton files
@@ -53,7 +53,7 @@ Feature: using trashbin together with sharing
| new | | new |
| spaces | | spaces |
@issue-1124
Scenario Outline: sharee deleting a file in a group-shared folder moves it to the trashbin of sharee and sharer only Scenario Outline: sharee deleting a file in a group-shared folder moves it to the trashbin of sharee and sharer only
Given using <dav-path-version> DAV path Given using <dav-path-version> DAV path
And user "Brian" has been created with default attributes and without skeleton files And user "Brian" has been created with default attributes and without skeleton files
@@ -109,7 +109,7 @@ Feature: using trashbin together with sharing
| new | | new |
| spaces | | spaces |
@issue-1124
Scenario Outline: sharee deleting a folder in a group-shared folder moves it to the trashbin of sharee and sharer only Scenario Outline: sharee deleting a folder in a group-shared folder moves it to the trashbin of sharee and sharer only
Given using <dav-path-version> DAV path Given using <dav-path-version> DAV path
And user "Brian" has been created with default attributes and without skeleton files And user "Brian" has been created with default attributes and without skeleton files
@@ -128,11 +128,11 @@ Feature: using trashbin together with sharing
| permissionsRole | Editor | | permissionsRole | Editor |
And user "Brian" has a share "shared" synced And user "Brian" has a share "shared" synced
And user "Carol" has a share "shared" synced And user "Carol" has a share "shared" synced
When user "Brian" deletes file "/Shares/shared/sub/shared_file.txt" using the WebDAV API When user "Brian" deletes folder "/Shares/shared/sub" using the WebDAV API
Then the HTTP status code should be "204" Then the HTTP status code should be "204"
And as "Brian" the file with original path "/Shares/shared/sub/shared_file.txt" should exist in the trashbin And as "Brian" the file with original path "/Shares/shared/sub/shared_file.txt" should exist in the trashbin
And as "Alice" the file with original path "/shared/sub/shared_file.txt" should exist in the trashbin And as "Alice" the file with original path "/shared/sub/shared_file.txt" should exist in the trashbin
And as "Carol" the file with original path "/Shares/sub/shared/shared_file.txt" should not exist in the trashbin And as "Carol" the file with original path "/Shares/shared/sub/shared_file.txt" should not exist in the trashbin
Examples: Examples:
| dav-path-version | | dav-path-version |
| new | | new |
@@ -157,7 +157,7 @@ Feature: using trashbin together with sharing
| permissionsRole | Editor | | permissionsRole | Editor |
And user "Brian" has a share "shared" synced And user "Brian" has a share "shared" synced
And user "Carol" has a share "shared" synced And user "Carol" has a share "shared" synced
When user "Alice" deletes file "/shared/sub/shared_file.txt" using the WebDAV API When user "Alice" deletes folder "/shared/sub" using the WebDAV API
Then the HTTP status code should be "204" Then the HTTP status code should be "204"
And as "Alice" the file with original path "/shared/sub/shared_file.txt" should exist in the trashbin And as "Alice" the file with original path "/shared/sub/shared_file.txt" should exist in the trashbin
And as "Brian" the file with original path "/Shares/shared/sub/shared_file.txt" should not exist in the trashbin And as "Brian" the file with original path "/Shares/shared/sub/shared_file.txt" should not exist in the trashbin
@@ -167,7 +167,7 @@ Feature: using trashbin together with sharing
| new | | new |
| spaces | | spaces |
@issue-7555 @issue-1124 @issue-7555
Scenario Outline: deleting a file in a received folder when restored it comes back to the original path Scenario Outline: deleting a file in a received folder when restored it comes back to the original path
Given using <dav-path-version> DAV path Given using <dav-path-version> DAV path
And user "Brian" has been created with default attributes and without skeleton files And user "Brian" has been created with default attributes and without skeleton files
@@ -214,7 +214,7 @@ Feature: copy file
| new | | new |
| spaces | | spaces |
@issue-1239 @skipOnReva @issue-1239 @issue-3874 @skipOnReva
Scenario Outline: copy a file over the top of an existing folder received as a user share Scenario Outline: copy a file over the top of an existing folder received as a user share
Given using <dav-path-version> DAV path Given using <dav-path-version> DAV path
And user "Brian" has been created with default attributes and without skeleton files And user "Brian" has been created with default attributes and without skeleton files
@@ -238,7 +238,30 @@ Feature: copy file
| old | | old |
| new | | new |
@issue-1239 @skipOnReva @skipOnReva
Scenario Outline: copy a file over the top of an existing file received as a share
Given using <dav-path-version> DAV path
And user "Alice" has uploaded file with content "file to copy" to "copy.txt"
And user "Brian" has been created with default attributes and without skeleton files
And user "Brian" has uploaded file with content "file to share" to "lorem.txt"
And user "Brian" has sent the following resource share invitation:
| resource | lorem.txt |
| space | Personal |
| sharee | Alice |
| shareType | user |
| permissionsRole | File Editor |
And user "Alice" has a share "lorem.txt" synced
When user "Alice" copies file "copy.txt" to "Shares/lorem.txt" using the WebDAV API
Then the HTTP status code should be "204"
And the content of file "Shares/lorem.txt" for user "Alice" should be "file to copy"
And the content of file "lorem.txt" for user "Brian" should be "file to copy"
And as "Brian" file "lorem.txt" should exist
Examples:
| dav-path-version |
| old |
| new |
@issue-1239 @issue-6999 @skipOnReva
Scenario Outline: copy a folder over the top of an existing file received as a user share Scenario Outline: copy a folder over the top of an existing file received as a user share
Given using <dav-path-version> DAV path Given using <dav-path-version> DAV path
And user "Brian" has been created with default attributes and without skeleton files And user "Brian" has been created with default attributes and without skeleton files
@@ -261,6 +284,30 @@ Feature: copy file
| old | | old |
| new | | new |
@issue-6999 @skipOnReva
Scenario Outline: copy a folder over the top of an existing folder received as a share
Given using <dav-path-version> DAV path
And user "Brian" has been created with default attributes and without skeleton files
And user "Brian" has created folder "BRIAN-Folder"
And user "Brian" has created folder "BRIAN-Folder/brian-folder"
And user "Brian" has sent the following resource share invitation:
| resource | BRIAN-Folder |
| space | Personal |
| sharee | Alice |
| shareType | user |
| permissionsRole | Editor |
And user "Alice" has a share "BRIAN-Folder" synced
And user "Alice" has created folder "FOLDER/alice-folder"
When user "Alice" copies folder "FOLDER" to "Shares/BRIAN-Folder" using the WebDAV API
Then the HTTP status code should be "204"
And as "Alice" folder "FOLDER/alice-folder" should exist
And as "Alice" folder "Shares/BRIAN-Folder/alice-folder" should exist
And as "Alice" folder "Shares/BRIAN-Folder/brian-folder" should not exist
Examples:
| dav-path-version |
| old |
| new |
@issue-1239 @skipOnReva @issue-1239 @skipOnReva
Scenario Outline: copy a folder into another folder at different level which is received as a user share Scenario Outline: copy a folder into another folder at different level which is received as a user share
Given using <dav-path-version> DAV path Given using <dav-path-version> DAV path
@@ -10,10 +10,21 @@ Feature: set file properties
@smokeTest @issue-1263 @smokeTest @issue-1263
Scenario Outline: setting custom DAV property and reading it Scenario Outline: setting custom DAV property and reading it
Given using <dav-path-version> DAV path Given using <dav-path-version> DAV path
And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "/testcustomprop.txt" And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "testcustomprop.txt"
And user "Alice" has set property "very-custom-prop" with namespace "x1='http://whatever.org/ns'" of file "/testcustomprop.txt" to "veryCustomPropValue" When user "Alice" sets property "very-custom-prop" of file "testcustomprop.txt" to "veryCustomPropValue"
When user "Alice" gets a custom property "very-custom-prop" with namespace "x1='http://whatever.org/ns'" of file "/testcustomprop.txt" Then the HTTP status code should be "207"
Then the response should contain a custom "very-custom-prop" property with namespace "x1='http://whatever.org/ns'" and value "veryCustomPropValue" And the xml response should contain a property "very-custom-prop"
And the content in the response should include the following content:
"""
<d:prop><very-custom-prop></very-custom-prop></d:prop>
"""
When user "Alice" gets a custom property "very-custom-prop" of file "testcustomprop.txt"
Then the HTTP status code should be "207"
And the response should contain a custom "very-custom-prop" property with value "veryCustomPropValue"
And the content in the response should include the following content:
"""
<d:prop><very-custom-prop>veryCustomPropValue</very-custom-prop></d:prop>
"""
Examples: Examples:
| dav-path-version | | dav-path-version |
| old | | old |
@@ -24,9 +35,12 @@ Feature: set file properties
Scenario Outline: setting custom complex DAV property and reading it Scenario Outline: setting custom complex DAV property and reading it
Given using <dav-path-version> DAV path Given using <dav-path-version> DAV path
And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "/testcustomprop.txt" And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "/testcustomprop.txt"
And user "Alice" has set property "very-custom-prop" with namespace "x1='http://whatever.org/ns'" of file "/testcustomprop.txt" to "<foo xmlns='http://bar'/>" When user "Alice" sets property "very-custom-prop" of file "testcustomprop.txt" to "<foo xmlns='http://bar'/>"
When user "Alice" gets a custom property "very-custom-prop" with namespace "x1='http://whatever.org/ns'" of file "/testcustomprop.txt" Then the HTTP status code should be "207"
Then the response should contain a custom "very-custom-prop" property with namespace "x1='http://whatever.org/ns'" and complex value "<x2:foo xmlns:x2=\"http://bar\"/>" And the xml response should contain a property "very-custom-prop"
When user "Alice" gets a custom property "very-custom-prop" of file "testcustomprop.txt"
Then the HTTP status code should be "207"
And the response should contain a custom "very-custom-prop" property with value "<foo xmlns='http://bar'/>"
Examples: Examples:
| dav-path-version | | dav-path-version |
| old | | old |
@@ -37,10 +51,10 @@ Feature: set file properties
Scenario Outline: setting custom DAV property and reading it after the file is renamed Scenario Outline: setting custom DAV property and reading it after the file is renamed
Given using <dav-path-version> DAV path Given using <dav-path-version> DAV path
And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "/testcustompropwithmove.txt" And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "/testcustompropwithmove.txt"
And user "Alice" has set property "very-custom-prop" with namespace "x1='http://whatever.org/ns'" of file "/testcustompropwithmove.txt" to "valueForMovetest" And user "Alice" has set property "very-custom-prop" of file "testcustompropwithmove.txt" to "valueForMovetest"
And user "Alice" has moved file "/testcustompropwithmove.txt" to "/catchmeifyoucan.txt" And user "Alice" has moved file "/testcustompropwithmove.txt" to "/catchmeifyoucan.txt"
When user "Alice" gets a custom property "very-custom-prop" with namespace "x1='http://whatever.org/ns'" of file "/catchmeifyoucan.txt" When user "Alice" gets a custom property "very-custom-prop" of file "catchmeifyoucan.txt"
Then the response should contain a custom "very-custom-prop" property with namespace "x1='http://whatever.org/ns'" and value "valueForMovetest" Then the response should contain a custom "very-custom-prop" property with value "valueForMovetest"
Examples: Examples:
| dav-path-version | | dav-path-version |
| old | | old |
@@ -59,9 +73,12 @@ Feature: set file properties
| shareType | user | | shareType | user |
| permissionsRole | File Editor | | permissionsRole | File Editor |
And user "Brian" has a share "testcustompropshared.txt" synced And user "Brian" has a share "testcustompropshared.txt" synced
And user "Alice" has set property "very-custom-prop" with namespace "x1='http://whatever.org/ns'" of file "/testcustompropshared.txt" to "valueForSharetest" When user "Alice" sets property "very-custom-prop" of file "testcustompropshared.txt" to "valueForSharetest"
When user "Brian" gets a custom property "very-custom-prop" with namespace "x1='http://whatever.org/ns'" of file "/testcustompropshared.txt" Then the HTTP status code should be "207"
Then the response should contain a custom "very-custom-prop" property with namespace "x1='http://whatever.org/ns'" and value "valueForSharetest" And the xml response should contain a property "very-custom-prop"
When user "Brian" gets a custom property "very-custom-prop" of file "Shares/testcustompropshared.txt"
Then the HTTP status code should be "207"
And the response should contain a custom "very-custom-prop" property with value "valueForSharetest"
Examples: Examples:
| dav-path-version | | dav-path-version |
| old | | old |
@@ -72,10 +89,13 @@ Feature: set file properties
Scenario Outline: setting custom DAV property using one endpoint and reading it with other endpoint Scenario Outline: setting custom DAV property using one endpoint and reading it with other endpoint
Given using <dav-path-version> DAV path Given using <dav-path-version> DAV path
And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "/testnewold.txt" And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "/testnewold.txt"
And user "Alice" has set property "very-custom-prop" with namespace "x1='http://whatever.org/ns'" of file "/testnewold.txt" to "lucky" When user "Alice" sets property "very-custom-prop" of file "testnewold.txt" to "lucky"
Then the HTTP status code should be "207"
And the xml response should contain a property "very-custom-prop"
And using <dav-path-version-2> DAV path And using <dav-path-version-2> DAV path
When user "Alice" gets a custom property "very-custom-prop" with namespace "x1='http://whatever.org/ns'" of file "/testnewold.txt" When user "Alice" gets a custom property "very-custom-prop" of file "testnewold.txt"
Then the response should contain a custom "very-custom-prop" property with namespace "x1='http://whatever.org/ns'" and value "lucky" Then the HTTP status code should be "207"
And the response should contain a custom "very-custom-prop" property with value "lucky"
Examples: Examples:
| dav-path-version | dav-path-version-2 | | dav-path-version | dav-path-version-2 |
| old | new | | old | new |
@@ -84,3 +104,27 @@ Feature: set file properties
| spaces | old | | spaces | old |
| new | spaces | | new | spaces |
| old | spaces | | old | spaces |
@issue-2140
Scenario Outline: setting custom DAV property with custom namespace and reading it
Given using <dav-path-version> DAV path
And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "testcustomprop.txt"
When user "Alice" sets property "very-custom-prop" with namespace "x1='http://whatever.org/ns'" of file "testcustomprop.txt" to "veryCustomPropValue" using the WebDAV API
Then the HTTP status code should be "207"
And the xml response should contain a property "x1:very-custom-prop" with namespace "x1='http://whatever.org/ns'"
And the content in the response should include the following content:
"""
<d:prop><x1:very-custom-prop xmlns:x1="http://whatever.org/ns"></x1:very-custom-prop></d:prop>
"""
When user "Alice" gets a custom property "x1:very-custom-prop" with namespace "x1='http://whatever.org/ns'" of file "testcustomprop.txt"
Then the HTTP status code should be "207"
And the response should contain a custom "x1:very-custom-prop" property with namespace "x1='http://whatever.org/ns'" and value "veryCustomPropValue"
And the content in the response should include the following content:
"""
<d:prop><x1:very-custom-prop xmlns:x1="http://whatever.org/ns">veryCustomPropValue</x1:very-custom-prop></d:prop>
"""
Examples:
| dav-path-version |
| old |
| new |
| spaces |