From 9a1a1423fe59271ed9f0e126c6bef3f1b0c4b265 Mon Sep 17 00:00:00 2001 From: Dipak Acharya Date: Thu, 10 Jun 2021 12:57:55 +0545 Subject: [PATCH] [Tests-Only] update test scenarios to work with ocis --- tests/TestHelpers/Asserts/WebDav.php | 8 +- tests/acceptance/config/behat.yml | 1 + .../checksums-TestOc10Issue38835.feature | 20 +++ .../features/apiMain/checksums.feature | 16 ++- .../apiWebdavProperties1/copyFile.feature | 130 ++++++++++-------- .../apiWebdavUploadTUS/uploadToShare.feature | 1 + .../features/bootstrap/ChecksumContext.php | 2 +- .../acceptance/features/bootstrap/Sharing.php | 11 +- 8 files changed, 120 insertions(+), 69 deletions(-) create mode 100644 tests/acceptance/features/apiMain/checksums-TestOc10Issue38835.feature diff --git a/tests/TestHelpers/Asserts/WebDav.php b/tests/TestHelpers/Asserts/WebDav.php index 5ebb58be5c5d..9b3a6d3ba61b 100644 --- a/tests/TestHelpers/Asserts/WebDav.php +++ b/tests/TestHelpers/Asserts/WebDav.php @@ -118,10 +118,10 @@ public static function assertContentOfRemoteAndLocalFileIsSame( $password, $remoteFile ); - + $localContent = \file_get_contents($localFile); $downloadedContent = $result->getBody()->getContents(); - + if ($shouldBeSame) { self::assertSame( $localContent, @@ -170,14 +170,14 @@ public static function assertContentOfDAVFileAndSkeletonFileOnSUT( $remoteFile ); $downloadedContent = $result->getBody()->getContents(); - + $localContent = SetupHelper::readSkeletonFile( $fileInSkeletonFolder, $baseUrl, $adminUsername, $adminPassword ); - + if ($shouldBeSame) { self::assertSame( $localContent, diff --git a/tests/acceptance/config/behat.yml b/tests/acceptance/config/behat.yml index 7345750b5789..8007f94db318 100644 --- a/tests/acceptance/config/behat.yml +++ b/tests/acceptance/config/behat.yml @@ -557,6 +557,7 @@ default: contexts: - FeatureContext: *common_feature_context_params - LoggingContext: + - OccContext: - WebDavPropertiesContext: - AppConfigurationContext: diff --git a/tests/acceptance/features/apiMain/checksums-TestOc10Issue38835.feature b/tests/acceptance/features/apiMain/checksums-TestOc10Issue38835.feature new file mode 100644 index 000000000000..e8b69e36646c --- /dev/null +++ b/tests/acceptance/features/apiMain/checksums-TestOc10Issue38835.feature @@ -0,0 +1,20 @@ +@api @notToImplementOnOCIS +Feature: checksums + + Background: + Given user "Alice" has been created with default attributes and without skeleton files + + # this is a bug demo scenario for https://github.com/owncloud/core/issues/38835 + # Once this scenario is fixed Delete this file and remove @skipOnOcV10 tag from tests/acceptance/features/apiMain/checksums.feature:132 + @files_sharing-app-required + Scenario: Sharing and modifying a file should return correct checksum in the propfind using new DAV path + Given the administrator has set the default folder for received shares to "Shares" + And auto-accept shares has been disabled + And using new DAV path + And user "Brian" has been created with default attributes and without skeleton files + And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "/myChecksumFile.txt" with checksum "MD5:d70b40f177b14b470d1756a3c12b963a" + When user "Alice" shares file "/myChecksumFile.txt" with user "Brian" using the sharing API + And user "Brian" accepts share "/myChecksumFile.txt" offered by user "Alice" using the sharing API + And user "Brian" uploads file with checksum "SHA1:ce5582148c6f0c1282335b87df5ed4be4b781399" and content "Some Text" to "/Shares/myChecksumFile.txt" using the WebDAV API + And user "Brian" requests the checksum of "/Shares/myChecksumFile.txt" via propfind + Then the webdav checksum should be empty diff --git a/tests/acceptance/features/apiMain/checksums.feature b/tests/acceptance/features/apiMain/checksums.feature index 251c0ab2886f..af0a3e6ed5cd 100644 --- a/tests/acceptance/features/apiMain/checksums.feature +++ b/tests/acceptance/features/apiMain/checksums.feature @@ -117,21 +117,27 @@ Feature: checksums @files_sharing-app-required @issue-ocis-reva-196 Scenario: Sharing a file with checksum should return the checksum in the propfind using new DAV path - Given using new DAV path + Given the administrator has set the default folder for received shares to "Shares" + And auto-accept shares has been disabled + And using new DAV path And user "Brian" has been created with default attributes and without skeleton files And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "/myChecksumFile.txt" with checksum "MD5:d70b40f177b14b470d1756a3c12b963a" When user "Alice" shares file "/myChecksumFile.txt" with user "Brian" using the sharing API - And user "Brian" requests the checksum of "/myChecksumFile.txt" via propfind + And user "Brian" accepts share "/myChecksumFile.txt" offered by user "Alice" using the sharing API + And user "Brian" requests the checksum of "/Shares/myChecksumFile.txt" via propfind Then the webdav checksum should match "SHA1:3ee962b839762adb0ad8ba6023a4690be478de6f MD5:d70b40f177b14b470d1756a3c12b963a ADLER32:8ae90960" @files_sharing-app-required - @issue-ocis-reva-196 + @issue-ocis-reva-196 @skipOnOcV10 Scenario: Sharing and modifying a file should return correct checksum in the propfind using new DAV path - Given using new DAV path + Given the administrator has set the default folder for received shares to "Shares" + And auto-accept shares has been disabled + And using new DAV path And user "Brian" has been created with default attributes and without skeleton files And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "/myChecksumFile.txt" with checksum "MD5:d70b40f177b14b470d1756a3c12b963a" When user "Alice" shares file "/myChecksumFile.txt" with user "Brian" using the sharing API - And user "Brian" uploads file with checksum "SHA1:ce5582148c6f0c1282335b87df5ed4be4b781399" and content "Some Text" to "/myChecksumFile.txt" using the WebDAV API + And user "Brian" accepts share "/myChecksumFile.txt" offered by user "Alice" using the sharing API + And user "Brian" uploads file with checksum "SHA1:ce5582148c6f0c1282335b87df5ed4be4b781399" and content "Some Text" to "/Shares/myChecksumFile.txt" using the WebDAV API Then as user "Alice" the webdav checksum of "/myChecksumFile.txt" via propfind should match "SHA1:ce5582148c6f0c1282335b87df5ed4be4b781399 MD5:56e57920c3c8c727bfe7a5288cdf61c4 ADLER32:1048035a" @issue-ocis-reva-56 diff --git a/tests/acceptance/features/apiWebdavProperties1/copyFile.feature b/tests/acceptance/features/apiWebdavProperties1/copyFile.feature index dd5138909b1d..e7559ff28611 100644 --- a/tests/acceptance/features/apiWebdavProperties1/copyFile.feature +++ b/tests/acceptance/features/apiWebdavProperties1/copyFile.feature @@ -6,6 +6,8 @@ Feature: copy file Background: Given using OCS API version "1" + And the administrator has set the default folder for received shares to "Shares" + And auto-accept shares has been disabled And user "Alice" has been created with default attributes and without skeleton files And user "Alice" has uploaded file with content "ownCloud test text file 0" to "/textfile0.txt" And user "Alice" has uploaded file with content "ownCloud test text file 1" to "/textfile1.txt" @@ -56,9 +58,10 @@ Feature: copy file | shareType | user | | permissions | read | | shareWith | Alice | - When user "Alice" copies file "/textfile0.txt" to "/testshare/textfile0.txt" using the WebDAV API + And user "Alice" has accepted share "/testshare" offered by user "Brian" + When user "Alice" copies file "/textfile0.txt" to "/Shares/testshare/textfile0.txt" using the WebDAV API Then the HTTP status code should be "403" - And user "Alice" downloads file "/testshare/textfile0.txt" using the WebDAV API + And user "Alice" downloads file "/Shares/testshare/textfile0.txt" using the WebDAV API And the HTTP status code should be "404" Examples: | dav_version | @@ -77,10 +80,11 @@ Feature: copy file | shareType | user | | permissions | read | | shareWith | Alice | + And user "Alice" has accepted share "/testshare" offered by user "Brian" And user "Brian" has copied file "textfile1.txt" to "/testshare/overwritethis.txt" - When user "Alice" copies file "/textfile0.txt" to "/testshare/overwritethis.txt" using the WebDAV API + When user "Alice" copies file "/textfile0.txt" to "/Shares/testshare/overwritethis.txt" using the WebDAV API Then the HTTP status code should be "403" - And the downloaded content when downloading file "/testshare/overwritethis.txt" for user "Alice" with range "bytes=0-6" should be "ownClou" + And the downloaded content when downloading file "/Shares/testshare/overwritethis.txt" for user "Alice" with range "bytes=0-6" should be "ownClou" Examples: | dav_version | | old | @@ -210,10 +214,11 @@ Feature: copy file And user "Brian" has created folder "/BRIAN-Folder" And user "Brian" has created folder "BRIAN-Folder/sample-folder" And user "Brian" has shared folder "BRIAN-Folder" with user "Alice" - When user "Alice" copies file "/textfile1.txt" to "/BRIAN-Folder" using the WebDAV API + And user "Alice" has accepted share "/BRIAN-Folder" offered by user "Brian" + When user "Alice" copies file "/textfile1.txt" to "/Shares/BRIAN-Folder" using the WebDAV API Then the HTTP status code should be "204" - And the content of file "/BRIAN-Folder" for user "Alice" should be "ownCloud test text file 1" - And as "Alice" folder "/BRIAN-Folder/sample-folder" should not exist + And the content of file "/Shares/BRIAN-Folder" for user "Alice" should be "ownCloud test text file 1" + And as "Alice" folder "/Shares/BRIAN-Folder/sample-folder" should not exist And as "Alice" file "/textfile1.txt" should exist And user "Alice" should not have any received shares Examples: @@ -227,11 +232,12 @@ Feature: copy file 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 "/sharedfile1.txt" And user "Brian" has shared file "/sharedfile1.txt" with user "Alice" + And user "Alice" has accepted share "/sharedfile1.txt" offered by user "Brian" And user "Alice" has created folder "FOLDER/sample-folder" - When user "Alice" copies folder "/FOLDER" to "/sharedfile1.txt" using the WebDAV API + When user "Alice" copies folder "/FOLDER" to "/Shares/sharedfile1.txt" using the WebDAV API Then the HTTP status code should be "204" And as "Alice" folder "/FOLDER/sample-folder" should exist - And as "Alice" folder "/sharedfile1.txt/sample-folder" should exist + And as "Alice" folder "/Shares/sharedfile1.txt/sample-folder" should exist And user "Alice" should not have any received shares Examples: | dav_version | @@ -246,15 +252,16 @@ Feature: copy file And user "Brian" has created folder "BRIAN-FOLDER/second-level-folder" And user "Brian" has created folder "BRIAN-FOLDER/second-level-folder/third-level-folder" And user "Brian" has shared folder "BRIAN-FOLDER" with user "Alice" + And user "Alice" has accepted share "/BRIAN-FOLDER" offered by user "Brian" And user "Alice" has created folder "Sample-Folder-A" And user "Alice" has created folder "Sample-Folder-A/sample-folder-b" And user "Alice" has created folder "Sample-Folder-A/sample-folder-b/sample-folder-c" - When user "Alice" copies folder "Sample-Folder-A/sample-folder-b" to "BRIAN-FOLDER/second-level-folder/third-level-folder" using the WebDAV API + When user "Alice" copies folder "Sample-Folder-A/sample-folder-b" to "Shares/BRIAN-FOLDER/second-level-folder/third-level-folder" using the WebDAV API Then the HTTP status code should be "204" And as "Alice" folder "/Sample-Folder-A/sample-folder-b/sample-folder-c" should exist - And as "Alice" folder "/BRIAN-FOLDER/second-level-folder/third-level-folder/sample-folder-c" should exist + And as "Alice" folder "/Shares/BRIAN-FOLDER/second-level-folder/third-level-folder/sample-folder-c" should exist And the response when user "Alice" gets the info of the last share should include - | file_target | /BRIAN-FOLDER | + | file_target | /Shares/BRIAN-FOLDER | Examples: | dav_version | | old | @@ -268,17 +275,18 @@ Feature: copy file And user "Brian" has created folder "BRIAN-FOLDER/second-level-folder" And user "Brian" has created folder "BRIAN-FOLDER/second-level-folder/third-level-folder" And user "Brian" has shared folder "BRIAN-FOLDER" with user "Alice" + And user "Alice" has accepted share "/BRIAN-FOLDER" offered by user "Brian" And user "Alice" has created folder "Sample-Folder-A" And user "Alice" has created folder "Sample-Folder-A/sample-folder-b" And user "Alice" has uploaded file with content "sample file-c" to "Sample-Folder-A/sample-folder-b/textfile-c.txt" - When user "Alice" copies file "Sample-Folder-A/sample-folder-b/textfile-c.txt" to "BRIAN-FOLDER/second-level-folder" using the WebDAV API + When user "Alice" copies file "Sample-Folder-A/sample-folder-b/textfile-c.txt" to "Shares/BRIAN-FOLDER/second-level-folder" using the WebDAV API Then the HTTP status code should be "204" - And as "Alice" folder "BRIAN-FOLDER/second-level-folder/third-level-folder" should not exist + And as "Alice" folder "Shares/BRIAN-FOLDER/second-level-folder/third-level-folder" should not exist And as "Alice" file "Sample-Folder-A/sample-folder-b/textfile-c.txt" should exist - And as "Alice" file "BRIAN-FOLDER/second-level-folder" should exist - And the content of file "BRIAN-FOLDER/second-level-folder" for user "Alice" should be "sample file-c" + And as "Alice" file "Shares/BRIAN-FOLDER/second-level-folder" should exist + And the content of file "Shares/BRIAN-FOLDER/second-level-folder" for user "Alice" should be "sample file-c" And the response when user "Alice" gets the info of the last share should include - | file_target | /BRIAN-FOLDER | + | file_target | /Shares/BRIAN-FOLDER | Examples: | dav_version | | old | @@ -291,17 +299,18 @@ Feature: copy file And user "Brian" has created folder "BRIAN-FOLDER" And user "Brian" has uploaded file with content "file at second level" to "BRIAN-FOLDER/second-level-file.txt" And user "Brian" has shared folder "BRIAN-FOLDER" with user "Alice" + And user "Alice" has accepted share "/BRIAN-FOLDER" offered by user "Brian" And user "Alice" has created folder "Sample-Folder-A" And user "Alice" has created folder "Sample-Folder-A/sample-folder-b" And user "Alice" has uploaded file with content "sample file-c" to "Sample-Folder-A/sample-folder-b/textfile-c.txt" - When user "Alice" copies file "Sample-Folder-A/sample-folder-b/textfile-c.txt" to "BRIAN-FOLDER/second-level-file.txt" using the WebDAV API + When user "Alice" copies file "Sample-Folder-A/sample-folder-b/textfile-c.txt" to "Shares/BRIAN-FOLDER/second-level-file.txt" using the WebDAV API Then the HTTP status code should be "204" And as "Alice" file "Sample-Folder-A/sample-folder-b/textfile-c.txt" should exist - And as "Alice" file "BRIAN-FOLDER/second-level-file.txt" should exist - And as "Alice" file "BRIAN-FOLDER/textfile-c.txt" should not exist - And the content of file "BRIAN-FOLDER/second-level-file.txt" for user "Alice" should be "sample file-c" + And as "Alice" file "Shares/BRIAN-FOLDER/second-level-file.txt" should exist + And as "Alice" file "Shares/BRIAN-FOLDER/textfile-c.txt" should not exist + And the content of file "Shares/BRIAN-FOLDER/second-level-file.txt" for user "Alice" should be "sample file-c" And the response when user "Alice" gets the info of the last share should include - | file_target | /BRIAN-FOLDER | + | file_target | /Shares/BRIAN-FOLDER | Examples: | dav_version | | old | @@ -315,22 +324,23 @@ Feature: copy file And user "Brian" has created folder "BRIAN-FOLDER/second-level-folder" And user "Brian" has uploaded file with content "file at third level" to "BRIAN-FOLDER/second-level-folder/third-level-file.txt" And user "Brian" has shared folder "BRIAN-FOLDER" with user "Alice" + And user "Alice" has accepted share "/BRIAN-FOLDER" offered by user "Brian" And user "Alice" has created folder "FOLDER/second-level-folder" And user "Alice" has created folder "FOLDER/second-level-folder/third-level-folder" - When user "Alice" copies folder "FOLDER/second-level-folder" to "BRIAN-FOLDER/second-level-folder/third-level-file.txt" using the WebDAV API + When user "Alice" copies folder "FOLDER/second-level-folder" to "/Shares/BRIAN-FOLDER/second-level-folder/third-level-file.txt" using the WebDAV API Then the HTTP status code should be "204" - And as "Alice" folder "BRIAN-FOLDER/second-level-folder/third-level-file.txt" should exist + And as "Alice" folder "Shares/BRIAN-FOLDER/second-level-folder/third-level-file.txt" should exist And as "Alice" folder "FOLDER/second-level-folder/third-level-folder" should exist - And as "Alice" folder "BRIAN-FOLDER/second-level-folder/third-level-file.txt/third-level-folder" should exist - And as "Alice" folder "BRIAN-FOLDER/second-level-folder/second-level-folder" should not exist + And as "Alice" folder "Shares/BRIAN-FOLDER/second-level-folder/third-level-file.txt/third-level-folder" should exist + And as "Alice" folder "Shares/BRIAN-FOLDER/second-level-folder/second-level-folder" should not exist And the response when user "Alice" gets the info of the last share should include - | file_target | /BRIAN-FOLDER | + | file_target | /Shares/BRIAN-FOLDER | Examples: | dav_version | | old | | new | - @issue-ocis-reva-34 @issue-ocis-reva-387 + @issue-ocis-reva-387 Scenario Outline: copy a file over the top of an existing folder received as a group share Given using DAV path And user "Brian" has been created with default attributes and without skeleton files @@ -339,11 +349,12 @@ Feature: copy file And user "Brian" has been added to group "grp1" And user "Brian" has created folder "/BRIAN-Folder" And user "Brian" has created folder "BRIAN-Folder/sample-folder" - And user "Brian" has shared folder "BRIAN-Folder" with group "grp1" - When user "Alice" copies file "/textfile1.txt" to "/BRIAN-Folder" using the WebDAV API + And user "Brian" has shared folder "BRIAN-Folder" with group "grp1" with permissions "15" + And user "Alice" has accepted share "/BRIAN-Folder" offered by user "Brian" + When user "Alice" copies file "/textfile1.txt" to "/Shares/BRIAN-Folder" using the WebDAV API Then the HTTP status code should be "204" - And the content of file "/BRIAN-Folder" for user "Alice" should be "ownCloud test text file 1" - And as "Alice" folder "/BRIAN-Folder/sample-folder" should not exist + And the content of file "/Shares/BRIAN-Folder" for user "Alice" should be "ownCloud test text file 1" + And as "Alice" folder "/Shares/BRIAN-Folder/sample-folder" should not exist And as "Alice" file "/textfile1.txt" should exist And user "Alice" should not have any received shares Examples: @@ -351,7 +362,7 @@ Feature: copy file | old | | new | - @issue-ocis-reva-34 @issue-ocis-reva-387 + @issue-ocis-reva-387 Scenario Outline: copy a folder over the top of an existing file received as a group share Given using DAV path And user "Brian" has been created with default attributes and without skeleton files @@ -360,18 +371,19 @@ Feature: copy file And user "Brian" has been added to group "grp1" And user "Brian" has uploaded file with content "file to share" to "/sharedfile1.txt" And user "Brian" has shared file "/sharedfile1.txt" with group "grp1" + And user "Alice" has accepted share "/sharedfile1.txt" offered by user "Brian" And user "Alice" has created folder "FOLDER/sample-folder" - When user "Alice" copies folder "/FOLDER" to "/sharedfile1.txt" using the WebDAV API + When user "Alice" copies folder "/FOLDER" to "/Shares/sharedfile1.txt" using the WebDAV API Then the HTTP status code should be "204" And as "Alice" folder "/FOLDER/sample-folder" should exist - And as "Alice" folder "/sharedfile1.txt/sample-folder" should exist + And as "Alice" folder "/Shares/sharedfile1.txt/sample-folder" should exist And user "Alice" should not have any received shares Examples: | dav_version | | old | | new | - @issue-ocis-reva-34 @issue-ocis-reva-387 + @issue-ocis-reva-387 Scenario Outline: copy a folder into another folder at different level which is received as a group share Given using DAV path And user "Brian" has been created with default attributes and without skeleton files @@ -382,21 +394,22 @@ Feature: copy file And user "Brian" has created folder "BRIAN-FOLDER/second-level-folder" And user "Brian" has created folder "BRIAN-FOLDER/second-level-folder/third-level-folder" And user "Brian" has shared folder "BRIAN-FOLDER" with group "grp1" + And user "Alice" has accepted share "/BRIAN-FOLDER" offered by user "Brian" And user "Alice" has created folder "Sample-Folder-A" And user "Alice" has created folder "Sample-Folder-A/sample-folder-b" And user "Alice" has created folder "Sample-Folder-A/sample-folder-b/sample-folder-c" - When user "Alice" copies folder "Sample-Folder-A/sample-folder-b" to "BRIAN-FOLDER/second-level-folder/third-level-folder" using the WebDAV API + When user "Alice" copies folder "Sample-Folder-A/sample-folder-b" to "Shares/BRIAN-FOLDER/second-level-folder/third-level-folder" using the WebDAV API Then the HTTP status code should be "204" And as "Alice" folder "/Sample-Folder-A/sample-folder-b/sample-folder-c" should exist - And as "Alice" folder "/BRIAN-FOLDER/second-level-folder/third-level-folder/sample-folder-c" should exist + And as "Alice" folder "/Shares/BRIAN-FOLDER/second-level-folder/third-level-folder/sample-folder-c" should exist And the response when user "Alice" gets the info of the last share should include - | file_target | /BRIAN-FOLDER | + | file_target | /Shares/BRIAN-FOLDER | Examples: | dav_version | | old | | new | - @issue-ocis-reva-34 @issue-ocis-reva-387 + @issue-ocis-reva-387 Scenario Outline: copy a file into a folder at different level received as a group share Given using DAV path And user "Brian" has been created with default attributes and without skeleton files @@ -407,23 +420,24 @@ Feature: copy file And user "Brian" has created folder "BRIAN-FOLDER/second-level-folder" And user "Brian" has created folder "BRIAN-FOLDER/second-level-folder/third-level-folder" And user "Brian" has shared folder "BRIAN-FOLDER" with group "grp1" + And user "Alice" has accepted share "/BRIAN-FOLDER" offered by user "Brian" And user "Alice" has created folder "Sample-Folder-A" And user "Alice" has created folder "Sample-Folder-A/sample-folder-b" And user "Alice" has uploaded file with content "sample file-c" to "Sample-Folder-A/sample-folder-b/textfile-c.txt" - When user "Alice" copies file "Sample-Folder-A/sample-folder-b/textfile-c.txt" to "BRIAN-FOLDER/second-level-folder" using the WebDAV API + When user "Alice" copies file "Sample-Folder-A/sample-folder-b/textfile-c.txt" to "Shares/BRIAN-FOLDER/second-level-folder" using the WebDAV API Then the HTTP status code should be "204" - And as "Alice" folder "BRIAN-FOLDER/second-level-folder/third-level-folder" should not exist + And as "Alice" folder "Shares/BRIAN-FOLDER/second-level-folder/third-level-folder" should not exist And as "Alice" file "Sample-Folder-A/sample-folder-b/textfile-c.txt" should exist - And as "Alice" file "BRIAN-FOLDER/second-level-folder" should exist - And the content of file "BRIAN-FOLDER/second-level-folder" for user "Alice" should be "sample file-c" + And as "Alice" file "Shares/BRIAN-FOLDER/second-level-folder" should exist + And the content of file "Shares/BRIAN-FOLDER/second-level-folder" for user "Alice" should be "sample file-c" And the response when user "Alice" gets the info of the last share should include - | file_target | /BRIAN-FOLDER | + | file_target | /Shares/BRIAN-FOLDER | Examples: | dav_version | | old | | new | - @issue-ocis-reva-34 @issue-ocis-reva-387 + @issue-ocis-reva-387 Scenario Outline: copy a file into a file at different level received as a group share Given using DAV path And user "Brian" has been created with default attributes and without skeleton files @@ -433,23 +447,24 @@ Feature: copy file And user "Brian" has created folder "BRIAN-FOLDER" And user "Brian" has uploaded file with content "file at second level" to "BRIAN-FOLDER/second-level-file.txt" And user "Brian" has shared folder "BRIAN-FOLDER" with group "grp1" + And user "Alice" has accepted share "/BRIAN-FOLDER" offered by user "Brian" And user "Alice" has created folder "Sample-Folder-A" And user "Alice" has created folder "Sample-Folder-A/sample-folder-b" And user "Alice" has uploaded file with content "sample file-c" to "Sample-Folder-A/sample-folder-b/textfile-c.txt" - When user "Alice" copies file "Sample-Folder-A/sample-folder-b/textfile-c.txt" to "BRIAN-FOLDER/second-level-file.txt" using the WebDAV API + When user "Alice" copies file "Sample-Folder-A/sample-folder-b/textfile-c.txt" to "Shares/BRIAN-FOLDER/second-level-file.txt" using the WebDAV API Then the HTTP status code should be "204" And as "Alice" file "Sample-Folder-A/sample-folder-b/textfile-c.txt" should exist - And as "Alice" file "BRIAN-FOLDER/second-level-file.txt" should exist - And as "Alice" file "BRIAN-FOLDER/textfile-c.txt" should not exist - And the content of file "BRIAN-FOLDER/second-level-file.txt" for user "Alice" should be "sample file-c" + And as "Alice" file "Shares/BRIAN-FOLDER/second-level-file.txt" should exist + And as "Alice" file "Shares/BRIAN-FOLDER/textfile-c.txt" should not exist + And the content of file "Shares/BRIAN-FOLDER/second-level-file.txt" for user "Alice" should be "sample file-c" And the response when user "Alice" gets the info of the last share should include - | file_target | /BRIAN-FOLDER | + | file_target | /Shares/BRIAN-FOLDER | Examples: | dav_version | | old | | new | - @issue-ocis-reva-34 @issue-ocis-reva-387 + @issue-ocis-reva-387 Scenario Outline: copy a folder into a file at different level received as a group share Given using DAV path And user "Brian" has been created with default attributes and without skeleton files @@ -460,16 +475,17 @@ Feature: copy file And user "Brian" has created folder "BRIAN-FOLDER/second-level-folder" And user "Brian" has uploaded file with content "file at third level" to "BRIAN-FOLDER/second-level-folder/third-level-file.txt" And user "Brian" has shared folder "BRIAN-FOLDER" with group "grp1" + And user "Alice" has accepted share "/BRIAN-FOLDER" offered by user "Brian" And user "Alice" has created folder "FOLDER/second-level-folder" And user "Alice" has created folder "FOLDER/second-level-folder/third-level-folder" - When user "Alice" copies folder "FOLDER/second-level-folder" to "BRIAN-FOLDER/second-level-folder/third-level-file.txt" using the WebDAV API + When user "Alice" copies folder "FOLDER/second-level-folder" to "Shares/BRIAN-FOLDER/second-level-folder/third-level-file.txt" using the WebDAV API Then the HTTP status code should be "204" - And as "Alice" folder "BRIAN-FOLDER/second-level-folder/third-level-file.txt" should exist + And as "Alice" folder "Shares/BRIAN-FOLDER/second-level-folder/third-level-file.txt" should exist And as "Alice" folder "FOLDER/second-level-folder/third-level-folder" should exist - And as "Alice" folder "BRIAN-FOLDER/second-level-folder/third-level-file.txt/third-level-folder" should exist - And as "Alice" folder "BRIAN-FOLDER/second-level-folder/second-level-folder" should not exist + And as "Alice" folder "Shares/BRIAN-FOLDER/second-level-folder/third-level-file.txt/third-level-folder" should exist + And as "Alice" folder "Shares/BRIAN-FOLDER/second-level-folder/second-level-folder" should not exist And the response when user "Alice" gets the info of the last share should include - | file_target | /BRIAN-FOLDER | + | file_target | /Shares/BRIAN-FOLDER | Examples: | dav_version | | old | diff --git a/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature b/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature index 13b231346be0..daea60fb1de6 100644 --- a/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature +++ b/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature @@ -46,6 +46,7 @@ Feature: upload file to shared folder And user "Brian" has been added to group "grp1" And user "Alice" has created folder "/FOLDER" And user "Alice" has shared folder "FOLDER" with group "grp1" with permissions "change" + And user "Brian" has accepted share "/FOLDER" offered by user "Alice" When user "Brian" uploads file with content "uploaded content" to "/Shares/FOLDER/textfile.txt" using the TUS protocol on the WebDAV API Then the HTTP status code should be "200" And as "Alice" file "/FOLDER/textfile.txt" should exist diff --git a/tests/acceptance/features/bootstrap/ChecksumContext.php b/tests/acceptance/features/bootstrap/ChecksumContext.php index 4df70ce15c5f..141d6d6fd8a4 100644 --- a/tests/acceptance/features/bootstrap/ChecksumContext.php +++ b/tests/acceptance/features/bootstrap/ChecksumContext.php @@ -361,7 +361,7 @@ public function userHasUploadedChunkFileOfWithToWithChecksum( $destination, $checksum ); - $this->featureContext->theHTTPStatusCodeShouldBe(201); + $this->featureContext->theHTTPStatusCodeShouldBeOr(201, 206); } /** diff --git a/tests/acceptance/features/bootstrap/Sharing.php b/tests/acceptance/features/bootstrap/Sharing.php index cae8b8efd28b..f8f73b58fe1c 100644 --- a/tests/acceptance/features/bootstrap/Sharing.php +++ b/tests/acceptance/features/bootstrap/Sharing.php @@ -932,6 +932,13 @@ public function userHasUpdatedTheLastShareWith($user, $body) { public function userHasUpdatedTheLastShareOfWith($user, $shareOwner, $body) { $this->updateLastShareWithSettings($user, $body, $shareOwner); $this->theHTTPStatusCodeShouldBeSuccess(); + if ($this->ocsApiVersion == 1) { + $this->ocsContext->theOCSStatusCodeShouldBe(100); + } elseif ($this->ocsApiVersion === 2) { + $this->ocsContext->theOCSStatusCodeShouldBe(200); + } else { + throw new Exception('Invalid ocs api version used'); + } } /** @@ -1854,14 +1861,14 @@ public function getListOfShares($user) { /** * Extracts `id` from responseXml * - * @return int|null + * @return string|null */ public function extractLastSharedIdFromLastResponse() { // extract max id $xpath = '/ocs/data/element/id[not (. < ../../element/id)][1]'; $id = $this->getResponseXml(null, __METHOD__)->xpath($xpath); if ((bool) $id) { - return (int) $id[0]; + return (string) $id[0]; } return null; }