Skip to content

Commit

Permalink
Merge pull request #9786 from owncloud/tests/adjust-failing-tests
Browse files Browse the repository at this point in the history
[tests-only][full-ci] adjust tests and expected-failure list
  • Loading branch information
saw-jan authored Aug 13, 2024
2 parents 465489f + f8530c0 commit a519eed
Show file tree
Hide file tree
Showing 19 changed files with 111 additions and 181 deletions.
53 changes: 10 additions & 43 deletions tests/acceptance/expected-failures-API-on-OCIS-storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,24 +70,12 @@ _ocdav: api compatibility, return correct status code_
- [coreApiAuth/webDavMKCOLAuth.feature:42](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuth/webDavMKCOLAuth.feature#L42)
- [coreApiAuth/webDavMKCOLAuth.feature:53](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuth/webDavMKCOLAuth.feature#L53)

#### [trying to lock file of another user gives http 200](https://github.com/owncloud/ocis/issues/2176)
#### [trying to lock file of another user gives http 500](https://github.com/owncloud/ocis/issues/2176)

- [coreApiAuth/webDavLOCKAuth.feature:46](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuth/webDavLOCKAuth.feature#L46)
- [coreApiAuth/webDavLOCKAuth.feature:58](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuth/webDavLOCKAuth.feature#L58)

#### [send POST requests to another user's webDav endpoints as normal user](https://github.com/owncloud/ocis/issues/1287)

_ocdav: api compatibility, return correct status code_

- [coreApiAuth/webDavPOSTAuth.feature:46](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuth/webDavPOSTAuth.feature#L46)
- [coreApiAuth/webDavPOSTAuth.feature:55](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuth/webDavPOSTAuth.feature#L55)

#### Another users space literally does not exist because it is not listed as a space for him, 404 seems correct, expects 403

- [coreApiAuth/webDavPUTAuth.feature:46](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuth/webDavPUTAuth.feature#L46)
- [coreApiAuth/webDavPUTAuth.feature:58](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuth/webDavPUTAuth.feature#L58)

#### [[old/new/spaces] In ocis and oc10, REPORT request response differently](https://github.com/owncloud/ocis/issues/4712)
#### [Missing properties in REPORT response](https://github.com/owncloud/ocis/issues/9780), [REPORT response has different date format for d:getlastmodified](https://github.com/owncloud/ocis/issues/9781), [d:getetag property has empty value in REPORT response](https://github.com/owncloud/ocis/issues/9783)

- [coreApiWebdavOperations/search.feature:180](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavOperations/search.feature#L180)
- [coreApiWebdavOperations/search.feature:181](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavOperations/search.feature#L181)
Expand All @@ -100,13 +88,13 @@ _ocdav: api compatibility, return correct status code_

- [coreApiFavorites/favorites.feature:101](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiFavorites/favorites.feature#L101)
- [coreApiFavorites/favorites.feature:102](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiFavorites/favorites.feature#L102)
- [coreApiFavorites/favorites.feature:103](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiFavorites/favorites.feature#L103)
- [coreApiFavorites/favorites.feature:124](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiFavorites/favorites.feature#L124)
- [coreApiFavorites/favorites.feature:125](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiFavorites/favorites.feature#L125)
- [coreApiFavorites/favorites.feature:126](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiFavorites/favorites.feature#L126)
- [coreApiFavorites/favorites.feature:189](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiFavorites/favorites.feature#L189)
- [coreApiFavorites/favorites.feature:190](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiFavorites/favorites.feature#L190)

And other missing implementation of favorites

- [coreApiFavorites/favorites.feature:191](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiFavorites/favorites.feature#L191)
- [coreApiFavorites/favorites.feature:145](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiFavorites/favorites.feature#L145)
- [coreApiFavorites/favorites.feature:146](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiFavorites/favorites.feature#L146)
- [coreApiFavorites/favorites.feature:147](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiFavorites/favorites.feature#L147)
Expand Down Expand Up @@ -169,35 +157,14 @@ Not everything needs to be implemented for ocis. While the oc10 testsuite covers
- _The `OC-LazyOps` header is [no longer supported by the client](https://github.com/owncloud/client/pull/8398), implementing this is not necessary for a first production release. We plan to have an upload state machine to visualize the state of a file, see https://github.com/owncloud/ocis/issues/214_
- _Blacklisted ignored files are no longer required because ocis can handle `.htaccess` files without security implications introduced by serving user provided files with apache._

#### [Blacklist files extensions](https://github.com/owncloud/ocis/issues/2177)

- [coreApiWebdavProperties/copyFile.feature:109](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L109)
- [coreApiWebdavProperties/copyFile.feature:110](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L110)
- [coreApiWebdavProperties/copyFile.feature:111](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L111)
- [coreApiWebdavProperties/createFileFolder.feature:95](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/createFileFolder.feature#L95)
- [coreApiWebdavProperties/createFileFolder.feature:96](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/createFileFolder.feature#L96)
- [coreApiWebdavProperties/createFileFolder.feature:97](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/createFileFolder.feature#L97)
- [coreApiWebdavUpload/uploadFile.feature:153](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavUpload/uploadFile.feature#L153)
- [coreApiWebdavUpload/uploadFile.feature:152](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavUpload/uploadFile.feature#L152)
- [coreApiWebdavUpload/uploadFile.feature:154](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavUpload/uploadFile.feature#L154)
- [coreApiWebdavMove2/moveFile.feature:177](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavMove2/moveFile.feature#L177)
- [coreApiWebdavMove2/moveFile.feature:178](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavMove2/moveFile.feature#L178)
- [coreApiWebdavMove2/moveFile.feature:143](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavMove2/moveFile.feature#L143)

#### [Renaming resource to banned name is allowed in spaces webdav](https://github.com/owncloud/ocis/issues/3099)

- [coreApiWebdavMove2/moveFile.feature:143](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavMove2/moveFile.feature#L143)
- [coreApiWebdavMove1/moveFolder.feature:36](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavMove1/moveFolder.feature#L36)
- [coreApiWebdavMove1/moveFolder.feature:50](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavMove1/moveFolder.feature#L50)
- [coreApiWebdavMove1/moveFolder.feature:64](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavMove1/moveFolder.feature#L64)
- [coreApiWebdavMove2/moveFile.feature:179](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavMove2/moveFile.feature#L179)

#### [REPORT method on spaces returns an incorrect d:href response](https://github.com/owncloud/ocis/issues/3111)

- [coreApiFavorites/favorites.feature:103](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiFavorites/favorites.feature#L103)
- [coreApiFavorites/favorites.feature:126](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiFavorites/favorites.feature#L126)
- [coreApiFavorites/favorites.feature:191](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiFavorites/favorites.feature#L191)

#### [HTTP status code differ while deleting file of another user's trash bin](https://github.com/owncloud/ocis/issues/3544)
#### [Trying to delete other user's trashbin item returns 409 for spaces path instead of 404](https://github.com/owncloud/ocis/issues/9791)

- [coreApiTrashbin/trashbinDelete.feature:92](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiTrashbin/trashbinDelete.feature#L92)

Expand All @@ -215,9 +182,9 @@ Not everything needs to be implemented for ocis. While the oc10 testsuite covers
### [COPY file/folder to same name is possible (but 500 code error for folder with spaces path)](https://github.com/owncloud/ocis/issues/8711)

- [coreApiSharePublicLink2/copyFromPublicLink.feature:198](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiSharePublicLink2/copyFromPublicLink.feature#L198)
- [coreApiWebdavProperties/copyFile.feature:1071](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L1071)
- [coreApiWebdavProperties/copyFile.feature:1072](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L1072)
- [coreApiWebdavProperties/copyFile.feature:1073](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L1073)
- [coreApiWebdavProperties/copyFile.feature:1067](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L1067)
- [coreApiWebdavProperties/copyFile.feature:1068](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L1068)
- [coreApiWebdavProperties/copyFile.feature:1069](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L1069)

Note: always have an empty line at the end of this file.
The bash script that processes this file requires that the last line has a newline on the end.
2 changes: 1 addition & 1 deletion tests/acceptance/features/bootstrap/FavoritesContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function userUnfavoritesElementUsingWebDavApi(string $user, string $path)
}

/**
* @Then /^user "([^"]*)" should (not|)\s?have favorited the following elements$/
* @Then /^user "([^"]*)" should (not|)\s?have the following favorited items$/
*
* @param string $user
* @param string $shouldOrNot (not|)
Expand Down
132 changes: 52 additions & 80 deletions tests/acceptance/features/bootstrap/TrashbinContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -502,41 +502,35 @@ public function theLastWebdavResponseShouldNotContainFollowingElements(TableNode
}

/**
* @When user :asUser tries to delete the file with original path :path from the trashbin of user :user using the trashbin API
* @When user :user tries to delete the file with original path :path from the trashbin of user :ofUser using the trashbin API
*
* @param string $asUser
* @param string $path
* @param string $user
* @param string $path
* @param string $ofUser
*
* @return void
* @throws Exception
*/
public function userTriesToDeleteFromTrashbinOfUser(string $asUser, string $path, string $user):void {
$responseArray = $this->tryToDeleteFileFromTrashbin($user, $path, $asUser);
foreach ($responseArray as $response) {
$this->featureContext->setResponse($response);
}
public function userTriesToDeleteFromTrashbinOfUser(string $user, string $path, string $ofUser):void {
$response = $this->deleteItemFromTrashbin($user, $path, $ofUser);
$this->featureContext->setResponse($response);
}

/**
* @When user :asUser tries to delete the file with original path :path from the trashbin of user :user using the password :password and the trashbin API
* @When user :user tries to delete the file with original path :path from the trashbin of user :ofUser using the password :password and the trashbin API
*
* @param string|null $asUser
* @param string|null $path
* @param string|null $user
* @param string|null $password
* @param string $user
* @param string $path
* @param string $ofUser
* @param string $password
*
* @return void
* @throws JsonException
* @throws Exception
*/
public function userTriesToDeleteFromTrashbinOfUserUsingPassword(?string $asUser, ?string $path, ?string $user, ?string $password):void {
$user = $this->featureContext->getActualUsername($user);
$asUser = $this->featureContext->getActualUsername($asUser);
$responseArray = $this->tryToDeleteFileFromTrashbin($user, $path, $asUser, $password);
foreach ($responseArray as $response) {
$this->featureContext->setResponse($response);
}
public function userTriesToDeleteFromTrashbinOfUserUsingPassword(string $user, string $path, string $ofUser, string $password):void {
$response = $this->deleteItemFromTrashbin($user, $path, $ofUser, $password);
$this->featureContext->setResponse($response);
}

/**
Expand Down Expand Up @@ -601,51 +595,54 @@ private function convertTrashbinHref(string $href):string {
* @return void
*/
public function userTriesToDeleteFileWithOriginalPathFromTrashbinUsingTrashbinAPI(string $user, string $originalPath):void {
$responseArray = $this->tryToDeleteFileFromTrashbin($user, $originalPath);
foreach ($responseArray as $response) {
$this->featureContext->setResponse($response);
}
$response = $this->deleteItemFromTrashbin($user, $originalPath);
$this->featureContext->setResponse($response);
}

/**
* @param string|null $user
* @param string|null $originalPath
* @param string|null $asUser
* @param string $user
* @param string $originalPath
* @param string|null $ofUser
* @param string|null $password
*
* @return array
* @return ResponseInterface
*/
public function tryToDeleteFileFromTrashbin(?string $user, ?string $originalPath, ?string $asUser = null, ?string $password = null):array {
public function deleteItemFromTrashbin(string $user, string $originalPath, ?string $ofUser = null, ?string $password = null): ResponseInterface {
$ofUser = $ofUser ?? $user;
$user = $this->featureContext->getActualUsername($user);
$asUser = $asUser ?? $user;
$listing = $this->listTrashbinFolder($user);
$originalPath = \trim($originalPath, '/');
$ofUser = $this->featureContext->getActualUsername($ofUser);

$listing = $this->listTrashbinFolder($ofUser);

$responseArray = [];
$path = "";
$originalPath = \trim($originalPath, '/');
foreach ($listing as $entry) {
// The entry for the trashbin root can have original-location null.
// That is reasonable, because the trashbin root is not something that can be restored.
$originalLocation = $entry['original-location'] ?? '';
if (\trim($originalLocation, '/') === $originalPath) {
$trashItemHRef = $this->convertTrashbinHref($entry['href']);
$response = $this->featureContext->makeDavRequest(
$asUser,
'DELETE',
$trashItemHRef,
[],
null,
'trash-bin',
null,
false,
$password,
[],
$user
);
$responseArray[] = $response;
$path = $entry['href'];
break;
}
}

return $responseArray;
if ($path === "") {
throw new Exception(
__METHOD__
. " could not find the trashbin entry for original path '$originalPath' of user '$user'"
);
}

$password = $password ?? $this->featureContext->getPasswordForUser($user);
$fullUrl = $this->featureContext->getBaseUrl() . $path;

return HttpRequestHelper::sendRequest(
$fullUrl,
$this->featureContext->getStepLineRef(),
"DELETE",
$user,
$password
);
}

/**
Expand All @@ -658,16 +655,8 @@ public function tryToDeleteFileFromTrashbin(?string $user, ?string $originalPath
* @throws Exception
*/
public function deleteFileFromTrashbin(string $user, string $originalPath):void {
$responseArray = $this->tryToDeleteFileFromTrashbin($user, $originalPath);
$numItemDeleted = \count($responseArray);
Assert::assertEquals(
1,
$numItemDeleted,
"Expected to delete exactly one item from the trashbin but $numItemDeleted were deleted"
);
foreach ($responseArray as $response) {
$this->featureContext->setResponse($response);
}
$response = $this->deleteItemFromTrashbin($user, $originalPath);
$this->featureContext->setResponse($response);
$this->featureContext->pushToLastStatusCodesArrays();
}

Expand All @@ -681,16 +670,8 @@ public function deleteFileFromTrashbin(string $user, string $originalPath):void
* @throws Exception
*/
public function userHasDeletedTheFolderWithOriginalPathFromTheTrashbin(string $user, string $originalPath):void {
$responseArray = $this->tryToDeleteFileFromTrashbin($user, $originalPath);
$numItemDeleted = \count($responseArray);
Assert::assertEquals(
1,
$numItemDeleted,
"Expected to delete exactly one item from the trashbin but $numItemDeleted were deleted"
);
foreach ($responseArray as $response) {
$this->featureContext->theHTTPStatusCodeShouldBe(204, '', $response);
}
$response = $this->deleteItemFromTrashbin($user, $originalPath);
$this->featureContext->theHTTPStatusCodeShouldBe(204, '', $response);
}

/**
Expand All @@ -707,17 +688,8 @@ public function deleteFollowingFilesFromTrashbin(string $user, TableNode $table)
$paths = $table->getHash();

foreach ($paths as $path) {
$responseArray = $this->tryToDeleteFileFromTrashbin($user, $path["path"]);
$numItemsDeleted = \count($responseArray);

Assert::assertEquals(
1,
$numItemsDeleted,
"Expected to delete exactly one item from the trashbin but $numItemsDeleted were deleted"
);
foreach ($responseArray as $response) {
$this->featureContext->setResponse($response);
}
$response = $this->deleteItemFromTrashbin($user, $path["path"]);
$this->featureContext->setResponse($response);
$this->featureContext->pushToLastStatusCodesArrays();
}
}
Expand Down
5 changes: 5 additions & 0 deletions tests/acceptance/features/bootstrap/WebDav.php
Original file line number Diff line number Diff line change
Expand Up @@ -1652,10 +1652,15 @@ public function checkElementList(
$elementToRequest,
"1"
);

// TODO: make it work for folder entries
// Doesn't work for folder entries
// as the folder entry has trailing '/' in d:href
$webdavPath = "/" . $this->getFullDavFilesPath($user) . $expectedElement;
$element = $responseXmlObject->xpath(
"//d:response/d:href[text() = \"$webdavPath\"]"
);

if ($expectedToBeListed
&& (!isset($element[0]) || urldecode($element[0]->__toString()) !== urldecode($webdavPath))
) {
Expand Down
4 changes: 2 additions & 2 deletions tests/acceptance/features/coreApiAuth/webDavLOCKAuth.feature
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Feature: LOCK file/folder
| /remote.php/dav/spaces/%spaceid%/PARENT/parent.txt |
Then the HTTP status code of responses on all endpoints should be "401"

@issue-1347
@issue-1347 @issue-2176
Scenario: send LOCK requests to another user's webDav endpoints as normal user
When user "Brian" requests these endpoints with "LOCK" to get property "d:shared" about user "Alice"
| endpoint |
Expand All @@ -54,7 +54,7 @@ Feature: LOCK file/folder
| /remote.php/dav/files/%username%/PARENT/parent.txt |
Then the HTTP status code of responses on all endpoints should be "409"

@issue-1347
@issue-1347 @issue-2176
Scenario: send LOCK requests to another user's webDav endpoints as normal user using the spaces WebDAV API
When user "Brian" requests these endpoints with "LOCK" to get property "d:shared" about user "Alice"
| endpoint |
Expand Down
Loading

0 comments on commit a519eed

Please sign in to comment.