From 9489e179dd9c1f27ce390ea6a311a6cea8a3510a Mon Sep 17 00:00:00 2001 From: "sagargurung1001@gmail.com" Date: Fri, 9 Sep 2022 10:43:24 +0545 Subject: [PATCH 1/3] Remove folder lock related tests from ocis --- tests/acceptance/config/behat.yml | 3 - .../features/apiSpaces/lockSpaces.feature | 90 ------------------- .../features/bootstrap/SpacesContext.php | 22 ----- 3 files changed, 115 deletions(-) delete mode 100644 tests/acceptance/features/apiSpaces/lockSpaces.feature diff --git a/tests/acceptance/config/behat.yml b/tests/acceptance/config/behat.yml index 851322de0..956f2c3cc 100644 --- a/tests/acceptance/config/behat.yml +++ b/tests/acceptance/config/behat.yml @@ -30,7 +30,6 @@ default: - PublicWebDavContext: - TrashbinContext: - WebDavPropertiesContext: - - WebDavLockingContext: apiSpaces: paths: @@ -49,7 +48,6 @@ default: - SearchContext: - TrashbinContext: - WebDavPropertiesContext: - - WebDavLockingContext: - TUSContext: - SpacesTUSContext: @@ -70,7 +68,6 @@ default: - FavoritesContext: - TrashbinContext: - WebDavPropertiesContext: - - WebDavLockingContext: apiGraph: paths: diff --git a/tests/acceptance/features/apiSpaces/lockSpaces.feature b/tests/acceptance/features/apiSpaces/lockSpaces.feature deleted file mode 100644 index f0ae101f1..000000000 --- a/tests/acceptance/features/apiSpaces/lockSpaces.feature +++ /dev/null @@ -1,90 +0,0 @@ -@api @skipOnOcV10 -Feature: lock - # Note: This Feature includes all the tests from core (apiWebdavLock suite) related to /Shares since in core no implementation is there for space Shares Jail - - Background: - Given these users have been created with default attributes and without skeleton files: - | username | - | Alice | - | Brian | - | Carol | - And user "Alice" has created folder "PARENT" - And user "Brian" has created folder "PARENT" - And user "Carol" has created folder "PARENT" - And using spaces DAV path - - - Scenario Outline: lock should propagate correctly when uploaded to a reshare that was locked by the owner - Given user "Alice" has shared folder "PARENT" with user "Brian" - And user "Brian" has accepted share "/PARENT" offered by user "Alice" - And user "Brian" has shared the following entity "PARENT" inside of space "Shares Jail" with user "Carol" with role "editor" - And user "Carol" has accepted share "/PARENT" offered by user "Brian" - And user "Alice" has locked folder "/PARENT" inside space "Personal" setting the following properties - | lockscope | | - When user "Carol" uploads a file inside space "Shares Jail" with content "uploaded by carol" to "PARENT/textfile.txt" using the WebDAV API - And user "Brian" uploads a file inside space "Shares Jail" with content "uploaded by brian" to "PARENT/textfile.txt" using the WebDAV API - And user "Alice" uploads file "filesForUpload/textfile.txt" to "/PARENT/textfile.txt" using the WebDAV API - Then the HTTP status code of responses on all endpoints should be "423" - And as "Alice" file "/PARENT/textfile.txt" should not exist - Examples: - | lock-scope | - | shared | - | exclusive | - - - Scenario Outline: lock should propagate correctly when uploaded overwriting to a reshare that was locked by the owner - Given user "Alice" has uploaded file with content "ownCloud test text file parent" to "PARENT/parent.txt" - And user "Alice" has shared folder "PARENT" with user "Brian" - And user "Brian" has accepted share "/PARENT" offered by user "Alice" - And user "Brian" has shared the following entity "PARENT" inside of space "Shares Jail" with user "Carol" with role "editor" - And user "Carol" has accepted share "/PARENT" offered by user "Brian" - And user "Alice" has locked folder "/PARENT" inside space "Personal" setting the following properties - | lockscope | | - When user "Carol" uploads a file inside space "Shares Jail" with content "uploaded by carol" to "PARENT/textfile.txt" using the WebDAV API - And user "Brian" uploads a file inside space "Shares Jail" with content "uploaded by brian" to "PARENT/textfile.txt" using the WebDAV API - And user "Alice" uploads file "filesForUpload/textfile.txt" to "/PARENT/parent.txt" using the WebDAV API - Then the HTTP status code of responses on all endpoints should be "423" - And the content of file "/PARENT/parent.txt" for user "Alice" should be "ownCloud test text file parent" - Examples: - | lock-scope | - | shared | - | exclusive | - - - Scenario Outline: lock should propagate correctly when the public uploads to a reshared share that was locked by the original owner - Given user "Alice" has shared folder "PARENT" with user "Brian" - And user "Brian" has accepted share "/PARENT" offered by user "Alice" - And user "Brian" has shared the following entity "PARENT" inside of space "Shares Jail" with user "Carol" with role "editor" - And user "Carol" has accepted share "/PARENT" offered by user "Brian" - And user "Carol" has created a public link share inside of space "Shares Jail" with settings: - | path | PARENT | - | shareType | 3 | - | permissions | 15 | - | name | public link | - And user "Alice" has locked folder "/PARENT" inside space "Personal" setting the following properties - | lockscope | | - When the public uploads file "test.txt" with content "test" using the new public WebDAV API - Then the HTTP status code should be "423" - And as "Alice" file "/PARENT/test.txt" should not exist - Examples: - | lock-scope | - | shared | - | exclusive | - - - Scenario Outline: lock should propagate correctly when uploaded to a reshare that was locked by the resharing user - Given user "Alice" has shared folder "PARENT" with user "Brian" - And user "Brian" has accepted share "/PARENT" offered by user "Alice" - And user "Brian" has shared the following entity "PARENT" inside of space "Shares Jail" with user "Carol" with role "editor" - And user "Carol" has accepted share "/PARENT" offered by user "Brian" - And user "Brian" has locked folder "/PARENT" inside space "Shares Jail" setting the following properties - | lockscope | | - When user "Carol" uploads a file inside space "Shares Jail" with content "uploaded by carol" to "PARENT/textfile.txt" using the WebDAV API - And user "Brian" uploads a file inside space "Shares Jail" with content "uploaded by brian" to "PARENT/textfile.txt" using the WebDAV API - And user "Alice" uploads file "filesForUpload/textfile.txt" to "/PARENT/textfile.txt" using the WebDAV API - Then the HTTP status code of responses on all endpoints should be "423" - And as "Alice" file "/PARENT/textfile.txt" should not exist - Examples: - | lock-scope | - | shared | - | exclusive | diff --git a/tests/acceptance/features/bootstrap/SpacesContext.php b/tests/acceptance/features/bootstrap/SpacesContext.php index 8525c55d1..f0f52a2d1 100644 --- a/tests/acceptance/features/bootstrap/SpacesContext.php +++ b/tests/acceptance/features/bootstrap/SpacesContext.php @@ -65,11 +65,6 @@ class SpacesContext implements Context { */ private FavoritesContext $favoritesContext; - /** - * @var WebDavLockingContext - */ - private WebDavLockingContext $webDavLockingContext; - /** * @var ChecksumContext */ @@ -460,7 +455,6 @@ class SpacesContext implements Context { $this->trashbinContext = $environment->getContext('TrashbinContext'); $this->webDavPropertiesContext = $environment->getContext('WebDavPropertiesContext'); $this->favoritesContext = $environment->getContext('FavoritesContext'); - $this->webDavLockingContext = $environment->getContext('WebDavLockingContext'); $this->checksumContext = $environment->getContext('ChecksumContext'); // Run the BeforeScenario function in OCSContext to set it up correctly $this->ocsContext->before($scope); @@ -2988,22 +2982,6 @@ class SpacesContext implements Context { } } - /** - * @Given /^user "([^"]*)" has locked folder "([^"]*)" inside space "([^"]*)" setting the following properties$/ - * - * @param string $user - * @param string $resource - * @param TableNode $properties - * @param string $spaceName - * - * @return void - * @throws Exception | GuzzleException - */ - public function userHasLockedResourceOfSpace(string $user, string $resource, TableNode $properties, string $spaceName): void { - $this->setSpaceIDByName($user, $spaceName); - $this->webDavLockingContext->lockFileUsingWebDavAPI($user, $resource, $properties); - } - /** * @When /^user "([^"]*)" creates a public link share of the space "([^"]*)" with settings:$/ * From f626e86b9693e9757a830ef7a4546c03c653c08b Mon Sep 17 00:00:00 2001 From: "sagargurung1001@gmail.com" Date: Fri, 9 Sep 2022 10:44:09 +0545 Subject: [PATCH 2/3] Remove expected to failure for folder lock related tests for spaces --- .../expected-failures-localAPI-on-OCIS-storage.md | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md index 0d845f0a4..ff27fa8ed 100644 --- a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md @@ -31,16 +31,6 @@ The expected failures in this file are from features in the owncloud/ocis repo. - [apiSpaces/changingFilesShare.feature:12](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/changingFilesShare.feature#L12) -#### [Webdav LOCK operations](https://github.com/owncloud/ocis/issues/1284) -- [apiSpaces/lockSpaces.feature:31](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/lockSpaces.feature#L31) -- [apiSpaces/lockSpaces.feature:32](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/lockSpaces.feature#L32) -- [apiSpaces/lockSpaces.feature:50](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/lockSpaces.feature#L50) -- [apiSpaces/lockSpaces.feature:51](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/lockSpaces.feature#L51) -- [apiSpaces/lockSpaces.feature:71](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/lockSpaces.feature#L71) -- [apiSpaces/lockSpaces.feature:72](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/lockSpaces.feature#L72) -- [apiSpaces/lockSpaces.feature:89](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/lockSpaces.feature#L89) -- [apiSpaces/lockSpaces.feature:90](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/lockSpaces.feature#L90) - ### [copy to overwrite (file and folder) from Personal to Shares Jail behaves differently](https://github.com/owncloud/ocis/issues/4393) - [apiSpaces/copySpaces.feature:487](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/copySpaces.feature#L487) - [apiSpaces/copySpaces.feature:501](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/copySpaces.feature#L501) From b7db48b04e362f49140d0ac1148e8a6b59f7eb3c Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Fri, 9 Sep 2022 14:14:10 +0545 Subject: [PATCH 3/3] fix code style --- .../features/bootstrap/SpacesContext.php | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/acceptance/features/bootstrap/SpacesContext.php b/tests/acceptance/features/bootstrap/SpacesContext.php index f0f52a2d1..47eb867fa 100644 --- a/tests/acceptance/features/bootstrap/SpacesContext.php +++ b/tests/acceptance/features/bootstrap/SpacesContext.php @@ -3148,20 +3148,20 @@ class SpacesContext implements Context { $this->featureContext->setResponseXmlObject($responseXml); } - /** - * @Then /^as user "([^"]*)" (?:file|folder|entry) "([^"]*)" inside space "([^"]*)" (should|should not) be favorited$/ - * - * @param string $user - * @param string $path - * @param string $spaceName - * @param string $shouldOrNot - * - * @return void - */ - public function asUserFileOrFolderInsideSpaceShouldOrNotBeFavorited(string $user, string $path, string $spaceName, string $shouldOrNot):void { - $this->setSpaceIDByName($user, $spaceName); - $this->favoritesContext->asUserFileOrFolderShouldBeFavorited($user, $path, ($shouldOrNot === 'should') ? 1 : 0); - } + /** + * @Then /^as user "([^"]*)" (?:file|folder|entry) "([^"]*)" inside space "([^"]*)" (should|should not) be favorited$/ + * + * @param string $user + * @param string $path + * @param string $spaceName + * @param string $shouldOrNot + * + * @return void + */ + public function asUserFileOrFolderInsideSpaceShouldOrNotBeFavorited(string $user, string $path, string $spaceName, string $shouldOrNot):void { + $this->setSpaceIDByName($user, $spaceName); + $this->favoritesContext->asUserFileOrFolderShouldBeFavorited($user, $path, ($shouldOrNot === 'should') ? 1 : 0); + } /** * @When /^user "([^"]*)" favorites element "([^"]*)" in space "([^"]*)" using the WebDAV API$/