From 0bf863b451e1c645ff4777fdd0518b6ef28ca6ff Mon Sep 17 00:00:00 2001 From: Sawjan Gurung Date: Wed, 4 Oct 2023 11:51:24 +0545 Subject: [PATCH] [tests-only] Added tests with depth:infinity enabled (#7395) * add depth infinity tests * fix step * add passing tests only * format rable --- .drone.star | 1 + tests/acceptance/config/behat.yml | 13 ++ .../apiDepthInfinity/propfind.feature | 114 ++++++++++++++++++ .../coreApiWebdavOperations/propfind.feature | 18 +-- 4 files changed, 139 insertions(+), 7 deletions(-) create mode 100644 tests/acceptance/features/apiDepthInfinity/propfind.feature diff --git a/.drone.star b/.drone.star index 034d0607ea..b161dd46c1 100644 --- a/.drone.star +++ b/.drone.star @@ -114,6 +114,7 @@ config = { "apiDownloads", "apiReshare", "apiSpacesDavOperation", + "apiDepthInfinity", ], "skip": False, }, diff --git a/tests/acceptance/config/behat.yml b/tests/acceptance/config/behat.yml index 97a7aa393a..16a61f2437 100644 --- a/tests/acceptance/config/behat.yml +++ b/tests/acceptance/config/behat.yml @@ -130,6 +130,19 @@ default: - GraphContext: - OcisConfigContext: + apiDepthInfinity: + paths: + - '%paths.base%/../features/apiDepthInfinity' + context: *common_ldap_suite_context + contexts: + - SpacesContext: + - FeatureContext: *common_feature_context_params + - OCSContext: + - GraphContext: + - PublicWebDavContext: + - TrashbinContext: + - OcisConfigContext: + apiAsyncUpload: paths: - '%paths.base%/../features/apiAsyncUpload' diff --git a/tests/acceptance/features/apiDepthInfinity/propfind.feature b/tests/acceptance/features/apiDepthInfinity/propfind.feature new file mode 100644 index 0000000000..49edab46bd --- /dev/null +++ b/tests/acceptance/features/apiDepthInfinity/propfind.feature @@ -0,0 +1,114 @@ +@env-config +Feature: PROPFIND with depth:infinity + As a user + I want to retrieve all properties of a resource + So that I can get the information about a resource + + Background: + Given the config "OCDAV_ALLOW_PROPFIND_DEPTH_INFINITY" has been set to "true" + And user "Alice" has been created with default attributes and without skeleton files + And user "Alice" has created the following folders + | path | + | simple-folder | + | simple-folder/simple-folder1 | + | simple-folder/simple-empty-folder | + | simple-folder/simple-folder1/simple-folder2 | + And user "Alice" has uploaded the following files with content "simple-test-content" + | path | + | textfile0.txt | + | welcome.txt | + | simple-folder/textfile0.txt | + | simple-folder/welcome.txt | + | simple-folder/simple-folder1/textfile0.txt | + | simple-folder/simple-folder1/welcome.txt | + | simple-folder/simple-folder1/simple-folder2/textfile0.txt | + | simple-folder/simple-folder1/simple-folder2/welcome.txt | + + + Scenario Outline: get the list of resources with depth infinity + Given using DAV path + When user "Alice" lists the resources in "/" with depth "infinity" using the WebDAV API + Then the HTTP status code should be "207" + And the last DAV response for user "Alice" should contain these nodes + | name | + | textfile0.txt | + | welcome.txt | + | simple-folder/ | + | simple-folder/textfile0.txt | + | simple-folder/welcome.txt | + | simple-folder/simple-empty-folder/ | + | simple-folder/simple-folder1/ | + | simple-folder/simple-folder1/simple-folder2 | + | simple-folder/simple-folder1/textfile0.txt | + | simple-folder/simple-folder1/welcome.txt | + | simple-folder/simple-folder1/simple-folder2/textfile0.txt | + | simple-folder/simple-folder1/simple-folder2/welcome.txt | + Examples: + | dav-path-version | + | old | + | new | + | spaces | + + + Scenario Outline: get the list of resources of a folder with depth infinity + Given using DAV path + When user "Alice" lists the resources in "simple-folder" with depth "infinity" using the WebDAV API + Then the HTTP status code should be "207" + And the last DAV response for user "Alice" should contain these nodes + | name | + | simple-folder/textfile0.txt | + | simple-folder/welcome.txt | + | simple-folder/simple-folder1/ | + | simple-folder/simple-folder1/simple-folder2 | + | simple-folder/simple-folder1/textfile0.txt | + | simple-folder/simple-folder1/welcome.txt | + | simple-folder/simple-folder1/simple-folder2/textfile0.txt | + | simple-folder/simple-folder1/simple-folder2/welcome.txt | + Examples: + | dav-path-version | + | old | + | new | + | spaces | + + + Scenario: get the list of resources in a folder shared through public link with depth infinity + Given using new DAV path + And user "Alice" has created a public link share of folder "simple-folder" + When the public lists the resources in the last created public link with depth "infinity" using the WebDAV API + Then the HTTP status code should be "207" + And the last public link DAV response should contain these nodes + | name | + | textfile0.txt | + | welcome.txt | + | simple-folder1/ | + | simple-folder1/welcome.txt | + | simple-folder1/simple-folder2 | + | simple-folder1/textfile0.txt | + | simple-folder1/simple-folder2/textfile0.txt | + | simple-folder1/simple-folder2/welcome.txt | + + + Scenario Outline: get the list of files in the trashbin with depth infinity + Given using DAV path + And user "Alice" has deleted the following resources + | path | + | textfile0.txt | + | welcome.txt | + | simple-folder/ | + When user "Alice" lists the resources in the trashbin with depth "infinity" using the WebDAV API + Then the HTTP status code should be "207" + And the trashbin DAV response should contain these nodes + | name | + | textfile0.txt | + | welcome.txt | + | simple-folder/ | + | simple-folder/textfile0.txt | + | simple-folder/welcome.txt | + | simple-folder/simple-folder1/textfile0.txt | + | simple-folder/simple-folder1/welcome.txt | + | simple-folder/simple-folder1/simple-folder2/textfile0.txt | + | simple-folder/simple-folder1/simple-folder2/welcome.txt | + Examples: + | dav-path-version | + | new | + | spaces | diff --git a/tests/acceptance/features/coreApiWebdavOperations/propfind.feature b/tests/acceptance/features/coreApiWebdavOperations/propfind.feature index a9972f96f4..bcd9c8349d 100644 --- a/tests/acceptance/features/coreApiWebdavOperations/propfind.feature +++ b/tests/acceptance/features/coreApiWebdavOperations/propfind.feature @@ -20,19 +20,23 @@ Feature: PROPFIND Scenario Outline: send PROPFIND request to "/remote.php/dav/(files|spaces)" with depth header Given user "Alice" has been created with default attributes and without skeleton files - When user "Alice" requests "" with "PROPFIND" using basic auth and with headers + When user "Alice" requests "" with "PROPFIND" using basic auth and with headers | header | value | | depth | | - Then the HTTP status code should be "207" + Then the HTTP status code should be "" Examples: - | dav_path | depth | - | /remote.php/dav/files/alice | 0 | - | /remote.php/dav/files/alice | infinity | + | dav-path | depth | http-code | + | /remote.php/webdav | 0 | 207 | + | /remote.php/webdav | 1 | 207 | + | /remote.php/dav/files/alice | 0 | 207 | + | /remote.php/dav/files/alice | 1 | 207 | @skipOnRevaMaster Examples: - | dav_path | depth | - | /remote.php/dav/spaces/%spaceid% | 0 | + | dav-path | depth | http-code | + | /remote.php/dav/spaces/%spaceid% | 0 | 207 | + | /remote.php/dav/spaces/%spaceid% | 1 | 207 | + | /remote.php/dav/spaces/%spaceid% | infinity | 400 | Scenario: send PROPFIND request to a public link