From 4543f3af3fee1adeb71f2b2127dfd41e15df929a Mon Sep 17 00:00:00 2001 From: Prajwol Amatya Date: Thu, 3 Apr 2025 09:25:18 +0545 Subject: [PATCH] added test to check share-types property by sharer after sharee is deleted --- .../bootstrap/WebDavPropertiesContext.php | 19 +++++-- ...ected-failures-localAPI-on-OCIS-storage.md | 10 ++++ .../apiContract/propfindShares.feature | 52 +++++++++++++++++++ 3 files changed, 76 insertions(+), 5 deletions(-) diff --git a/tests/acceptance/bootstrap/WebDavPropertiesContext.php b/tests/acceptance/bootstrap/WebDavPropertiesContext.php index ac369e36425..83f9e6f60a4 100644 --- a/tests/acceptance/bootstrap/WebDavPropertiesContext.php +++ b/tests/acceptance/bootstrap/WebDavPropertiesContext.php @@ -515,9 +515,10 @@ class WebDavPropertiesContext implements Context { } /** - * @Then the single response should contain a property :property with a child property :childProperty + * @Then /^the single response should contain a property "([^"]*)" (with|without) a child property "([^"]*)"$/ * * @param string $property + * @param string $withOrWithout * @param string $childProperty * * @return void @@ -526,15 +527,23 @@ class WebDavPropertiesContext implements Context { */ public function theSingleResponseShouldContainAPropertyWithChildProperty( string $property, + string $withOrWithout, string $childProperty ): void { $xmlPart = HttpRequestHelper::getResponseXml($this->featureContext->getResponse())->xpath( "//d:prop/$property/$childProperty" ); - Assert::assertTrue( - isset($xmlPart[0]), - "Cannot find property \"$property/$childProperty\"" - ); + if ($withOrWithout === "with") { + Assert::assertTrue( + isset($xmlPart[0]), + "Cannot find property \"$property/$childProperty\"" + ); + } else { + Assert::assertFalse( + isset($xmlPart[0]), + "Found property \"$property/$childProperty\"" + ); + } } /** diff --git a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md index b01b7967d4e..6c48c399aef 100644 --- a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md @@ -357,5 +357,15 @@ The expected failures in this file are from features in the owncloud/ocis repo. - [apiContract/propfindShares.feature:171](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiContract/propfindShares.feature#L171) - [apiContract/propfindShares.feature:172](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiContract/propfindShares.feature#L172) +#### [PROPFIND request to resource shared with user when deleted retains it's property](https://github.com/owncloud/ocis/issues/9463) +- [apiContract/propfindShares.feature:194](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiContract/propfindShares.feature#L194) +- [apiContract/propfindShares.feature:195](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiContract/propfindShares.feature#L195) +- [apiContract/propfindShares.feature:196](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiContract/propfindShares.feature#L196) +- [apiContract/propfindShares.feature:197](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiContract/propfindShares.feature#L197) +- [apiContract/propfindShares.feature:198](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiContract/propfindShares.feature#L198) +- [apiContract/propfindShares.feature:199](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiContract/propfindShares.feature#L199) +- [apiContract/propfindShares.feature:223](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiContract/propfindShares.feature#L223) +- [apiContract/propfindShares.feature:224](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiContract/propfindShares.feature#L224) + 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. diff --git a/tests/acceptance/features/apiContract/propfindShares.feature b/tests/acceptance/features/apiContract/propfindShares.feature index 51d206617e3..0738e5e3e65 100644 --- a/tests/acceptance/features/apiContract/propfindShares.feature +++ b/tests/acceptance/features/apiContract/propfindShares.feature @@ -170,3 +170,55 @@ Feature: propfind a shares | old | | new | | spaces | + + @issue-9463 + Scenario Outline: sharer checks share-types property after sharee is deleted (Personal Space) + Given using DAV path + And user "Alice" has created folder "folderToShare" + And user "Alice" has uploaded file with content "some content" to "testfile.txt" + And user "Alice" has sent the following resource share invitation: + | resource | | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | + And user "Brian" has a share "" synced + And the user "Admin" has deleted a user "Brian" + When user "Alice" gets the following properties of resource "" inside space "Personal" using the WebDAV API + | propertyName | + | oc:share-types | + Then the HTTP status code should be "207" + And the single response should contain a property "oc:share-types" without a child property "oc:share-type" + Examples: + | dav-path-version | resource | + | old | folderToShare | + | old | testfile.txt | + | new | folderToShare | + | new | testfile.txt | + | spaces | folderToShare | + | spaces | testfile.txt | + + @issue-9463 + Scenario Outline: sharer checks share-types property after sharee is deleted (Project Space) + Given using spaces DAV path + And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API + And user "Alice" has created a space "NewSpace" with the default quota using the Graph API + And user "Alice" has created a folder "folderToShare" in space "NewSpace" + And user "Alice" has uploaded a file inside space "NewSpace" with content "some content" to "testfile.txt" + And user "Alice" has sent the following resource share invitation: + | resource | | + | space | NewSpace | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | + And user "Brian" has a share "" synced + And the user "Admin" has deleted a user "Brian" + When user "Alice" gets the following properties of resource "" inside space "NewSpace" using the WebDAV API + | propertyName | + | oc:share-types | + Then the HTTP status code should be "207" + And the single response should contain a property "oc:share-types" without a child property "oc:share-type" + Examples: + | resource | + | folderToShare | + | testfile.txt |