diff --git a/tests/TestHelpers/Asserts/WebDav.php b/tests/TestHelpers/Asserts/WebDav.php index 159e99277c30..9a420c9f6d2e 100644 --- a/tests/TestHelpers/Asserts/WebDav.php +++ b/tests/TestHelpers/Asserts/WebDav.php @@ -104,10 +104,10 @@ public static function assertContentOfRemoteAndLocalFileIsSame( $result = DownloadHelper::download( $baseUrl, $username, $password, $remoteFile ); - + $localContent = \file_get_contents($localFile); $downloadedContent = $result->getBody()->getContents(); - + if ($shouldBeSame) { self::assertSame( $localContent, $downloadedContent @@ -154,11 +154,11 @@ public static function assertContentOfDAVFileAndSkeletonFileOnSUT( $remoteFile ); $downloadedContent = $result->getBody()->getContents(); - + $localContent = SetupHelper::readSkeletonFile( $fileInSkeletonFolder, $baseUrl, $adminUsername, $adminPassword ); - + if ($shouldBeSame) { self::assertSame( $localContent, $downloadedContent 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.feature b/tests/acceptance/features/apiMain/checksums.feature index 251c0ab2886f..bd356837ba47 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 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..a4285af840e6 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" @@ -341,7 +343,7 @@ Feature: copy file 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 - Then the HTTP status code should be "204" + Then the HTTP status code should be "204" or "201" 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 as "Alice" file "/textfile1.txt" should exist @@ -362,7 +364,7 @@ Feature: copy file And user "Brian" has shared file "/sharedfile1.txt" with group "grp1" And user "Alice" has created folder "FOLDER/sample-folder" When user "Alice" copies folder "/FOLDER" to "/sharedfile1.txt" using the WebDAV API - Then the HTTP status code should be "204" + Then the HTTP status code should be "204" or "201" And as "Alice" folder "/FOLDER/sample-folder" should exist And as "Alice" folder "/sharedfile1.txt/sample-folder" should exist And user "Alice" should not have any received shares @@ -382,11 +384,12 @@ 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 - Then the HTTP status code should be "204" + 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" or "201" 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 the response when user "Alice" gets the info of the last share should include @@ -407,15 +410,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 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 - Then the HTTP status code should be "204" - And as "Alice" folder "BRIAN-FOLDER/second-level-folder/third-level-folder" should not exist + 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" or "201" + 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 | Examples: @@ -433,15 +437,16 @@ 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 | Examples: @@ -451,7 +456,7 @@ Feature: copy file @issue-ocis-reva-34 @issue-ocis-reva-387 Scenario Outline: copy a folder into a file at different level received as a group share - Given using DAV path + Given using old DAV path And user "Brian" has been created with default attributes and without skeleton files And group "grp1" has been created And user "Alice" has been added to group "grp1" @@ -460,14 +465,15 @@ 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 | Examples: 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 707296d80009..d1e2977c86c4 100644 --- a/tests/acceptance/features/bootstrap/ChecksumContext.php +++ b/tests/acceptance/features/bootstrap/ChecksumContext.php @@ -338,7 +338,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 d3bffd8a48a8..9dd1da60a9fd 100644 --- a/tests/acceptance/features/bootstrap/Sharing.php +++ b/tests/acceptance/features/bootstrap/Sharing.php @@ -377,6 +377,7 @@ public function userCreatesAPublicLinkShareWithSettings($user, $body) { */ public function userHasCreatedAPublicLinkShareWithSettings($user, $body) { $this->userCreatesAPublicLinkShareWithSettings($user, $body); + var_dump($this->response->getBody()->getContents()); $this->ocsContext->theOCSStatusCodeShouldBe([100, 200]); $this->theHTTPStatusCodeShouldBe(200); } @@ -1719,14 +1720,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; }