Skip to content

Commit

Permalink
remove and add same kind of steps in the scenario and refactored func…
Browse files Browse the repository at this point in the history
…tion names
  • Loading branch information
KarunAtreya committed Oct 11, 2023
1 parent 0b4f1b6 commit a57c45d
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 49 deletions.
4 changes: 2 additions & 2 deletions tests/acceptance/expected-failures-API-on-OCIS-storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ cannot share a folder with create permission

#### [Public link enforce permissions](https://github.com/owncloud/ocis/issues/1269)

- [coreApiSharePublicLink1/createPublicLinkShare.feature:329](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiSharePublicLink1/createPublicLinkShare.feature#L329)
- [coreApiSharePublicLink1/createPublicLinkShare.feature:328](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiSharePublicLink1/createPublicLinkShare.feature#L328)

#### [copying a folder within a public link folder to folder with same name as an already existing file overwrites the parent file](https://github.com/owncloud/ocis/issues/1232)

Expand Down Expand Up @@ -340,7 +340,7 @@ API, search, favorites, config, capabilities, not existing endpoints, CORS and o
- [coreApiAuthOcs/ocsGETAuth.feature:123](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuthOcs/ocsGETAuth.feature#L123)
- [coreApiAuthOcs/ocsPOSTAuth.feature:10](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuthOcs/ocsPOSTAuth.feature#L10)
- [coreApiAuthOcs/ocsPUTAuth.feature:10](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuthOcs/ocsPUTAuth.feature#L10)
- [coreApiSharePublicLink1/createPublicLinkShare.feature:319](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiSharePublicLink1/createPublicLinkShare.feature#L319)
- [coreApiSharePublicLink1/createPublicLinkShare.feature:318](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiSharePublicLink1/createPublicLinkShare.feature#L318)

#### [sending MKCOL requests to another or non-existing user's webDav endpoints as normal user should return 404](https://github.com/owncloud/ocis/issues/5049)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ Feature: A manager of the space can edit public link
| share_type | public_link |
| displayname_owner | %displayname% |
| name | <linkName> |
And the public should be able to download file "/test.txt" from inside the last public link shared folder using the new public WebDAV API with password "<password>"
When the public downloads file "/test.txt" from inside the last public link shared folder using the new public WebDAV API with password "<password>"
Then the downloaded content should be "some content"
Then the HTTP status code should be "200"
And the downloaded content should be "some content"
Examples:
| permissions | expectedPermissions | password | linkName |
| 5 | read,create | newPass | |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ Feature: Share spaces via link
| displayname_owner | %displayname% |
| uid_owner | %username% |
| name | <linkName> |
And the public should be able to download file "/test.txt" from inside the last public link shared folder using the new public WebDAV API with password "<password>"
When the public downloads file "/test.txt" from inside the last public link shared folder using the new public WebDAV API with password "<password>"
Then the downloaded content should be "some content"
Then the HTTP status code should be "200"
And the downloaded content should be "some content"
But the public should not be able to download file "/test.txt" from inside the last public link shared folder using the new public WebDAV API with password "wrong pass"
Examples:
| permissions | expectedPermissions | password | linkName | expireDate |
Expand Down
45 changes: 13 additions & 32 deletions tests/acceptance/features/bootstrap/PublicWebDavContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function downloadPublicFileWithRange(string $range, string $publicWebDAVA
} else {
$path = "";
}
return $this->downloadTheFileInsideThePublicSharedFolder(
return $this->downloadFileFromPublicFolder(
$path,
$password,
$range,
Expand All @@ -79,7 +79,7 @@ public function downloadPublicFileWithRangeAndPassword(string $range, string $pa
} else {
$path = "";
}
$response = $this->downloadTheFileInsideThePublicSharedFolder(
$response = $this->downloadFileFromPublicFolder(
$path,
$password,
$range,
Expand Down Expand Up @@ -232,7 +232,7 @@ public function thePublicRenamesFileFromTheLastPublicShareUsingThePasswordPasswo
* @return void
*/
public function downloadPublicFileInsideAFolder(string $path, string $publicWebDAVAPIVersion = "old"):void {
$response = $this->downloadTheFileInsideThePublicSharedFolder(
$response = $this->downloadFileFromPublicFolder(
$path,
"",
"",
Expand All @@ -251,7 +251,7 @@ public function downloadPublicFileInsideAFolder(string $path, string $publicWebD
* @return void
*/
public function downloadPublicFileInsideAFolderWithPassword(string $path, string $publicWebDAVAPIVersion = "old", string $password = ""):void {
$response = $this->downloadTheFileInsideThePublicSharedFolder(
$response = $this->downloadFileFromPublicFolder(
$path,
$password,
"",
Expand All @@ -260,26 +260,6 @@ public function downloadPublicFileInsideAFolderWithPassword(string $path, string
$this->featureContext->setResponse($response);
}

/**
* @param string $path
* @param string|null $password
* @param string $publicWebDAVAPIVersion
*
* @return ResponseInterface
*/
public function downloadTheFileInsideThePublicSharedFolderWithPassword(
string $path,
?string $password = "",
string $publicWebDAVAPIVersion = "old"
):ResponseInterface {
return $this->downloadTheFileInsideThePublicSharedFolder(
$path,
$password,
"",
$publicWebDAVAPIVersion
);
}

/**
* @When /^the public downloads file "([^"]*)" from inside the last public link shared folder with range "([^"]*)" using the (old|new) public WebDAV API$/
*
Expand All @@ -290,7 +270,7 @@ public function downloadTheFileInsideThePublicSharedFolderWithPassword(
* @return void
*/
public function downloadPublicFileInsideAFolderWithRange(string $path, string $range, string $publicWebDAVAPIVersion):void {
$response = $this->downloadTheFileInsideThePublicSharedFolder(
$response = $this->downloadFileFromPublicFolder(
$path,
"",
$range,
Expand All @@ -307,7 +287,7 @@ public function downloadPublicFileInsideAFolderWithRange(string $path, string $r
*
* @return ResponseInterface
*/
public function downloadTheFileInsideThePublicSharedFolder(
public function downloadFileFromPublicFolder(
string $path,
string $password,
string $range,
Expand Down Expand Up @@ -885,9 +865,10 @@ public function shouldBeAbleToDownloadFileInsidePublicSharedFolderWithPasswordAn
return;
}

$response = $this->downloadTheFileInsideThePublicSharedFolderWithPassword(
$response = $this->downloadFileFromPublicFolder(
$path,
$password,
"",
$publicWebDAVAPIVersion
);

Expand Down Expand Up @@ -917,12 +898,12 @@ public function shouldBeAbleToDownloadFileInsidePublicSharedFolderWithPasswordAn
return;
}

$response = $this->downloadTheFileInsideThePublicSharedFolderWithPassword(
$response = $this->downloadFileFromPublicFolder(
$path,
$password,
"",
$publicWebDAVAPIVersion
);

$this->featureContext->checkDownloadedContentMatches($content, "", $response);

$this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response);
Expand Down Expand Up @@ -993,7 +974,7 @@ public function shouldBeAbleToDownloadRangeOfFileInsidePublicSharedFolderWithPas
return;
}

$response = $this->downloadTheFileInsideThePublicSharedFolder(
$response = $this->downloadFileFromPublicFolder(
$path,
$password,
$range,
Expand Down Expand Up @@ -1025,7 +1006,7 @@ public function shouldNotBeAbleToDownloadRangeOfFileInsidePublicSharedFolderWith
return;
}

$response = $this->downloadTheFileInsideThePublicSharedFolder(
$response = $this->downloadFileFromPublicFolder(
$path,
$password,
$range,
Expand Down Expand Up @@ -1252,7 +1233,7 @@ public function publiclyUploadingShouldWork(string $publicWebDAVAPIVersion):void
$path,
$publicWebDAVAPIVersion
);
$response = $this->downloadTheFileInsideThePublicSharedFolder(
$response = $this->downloadFileFromPublicFolder(
$path,
"",
"",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,12 @@ Feature: create a public link share
| uid_owner | %username% |
| name | |
And the public should be able to download the last publicly shared file using the new public WebDAV API with password "%public%" and the content should be "Random data"
And the HTTP status code should be "200"
And the public download of the last publicly shared file using the new public WebDAV API with password "%regular%" should fail with HTTP status code "401"
When the public downloads the last public link shared file with password "%regular%" using the new public WebDAV API
Then the value of the item "//s:message" in the response should match "/Username or password was incorrect/"
And the public download of the last publicly shared file using the new public WebDAV API without a password should fail with HTTP status code "401"
Then the HTTP status code should be "401"
And the value of the item "//s:message" in the response should match "/Username or password was incorrect/"
When the public downloads the last public link shared file using the new public WebDAV API
Then the value of the item "//s:message" in the response should match "/No 'Authorization: Basic' header found/"
Then the HTTP status code should be "401"
And the value of the item "//s:message" in the response should match "/No 'Authorization: Basic' header found/"
Examples:
| ocs_api_version | ocs_status_code |
| 1 | 100 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ Feature: reshare as public link
| publicUpload | false |
Then the OCS status code should be "<ocs_status_code>"
And the HTTP status code should be "200"
And the public should be able to download file "file.txt" from inside the last public link shared folder using the new public WebDAV API
When the public downloads file "file.txt" from inside the last public link shared folder using the new public WebDAV API
Then the downloaded content should be "some content"
Then the HTTP status code should be "200"
And the downloaded content should be "some content"
But uploading a file should not work using the new public WebDAV API
Examples:
| ocs_api_version | ocs_status_code |
Expand Down Expand Up @@ -91,9 +91,9 @@ Feature: reshare as public link
| publicUpload | false |
Then the OCS status code should be "<ocs_status_code>"
And the HTTP status code should be "200"
And the public should be able to download file "file.txt" from inside the last public link shared folder using the new public WebDAV API
When the public downloads file "file.txt" from inside the last public link shared folder using the new public WebDAV API
Then the downloaded content should be "some content"
Then the HTTP status code should be "200"
And the downloaded content should be "some content"
But uploading a file should not work using the new public WebDAV API
Examples:
| ocs_api_version | ocs_status_code |
Expand All @@ -113,9 +113,9 @@ Feature: reshare as public link
| publicUpload | true |
Then the OCS status code should be "<ocs_status_code>"
And the HTTP status code should be "200"
And the public should be able to download file "file.txt" from inside the last public link shared folder using the new public WebDAV API
When the public downloads file "file.txt" from inside the last public link shared folder using the new public WebDAV API
Then the downloaded content should be "some content"
Then the HTTP status code should be "200"
And the downloaded content should be "some content"
And uploading a file should work using the new public WebDAV API
Examples:
| ocs_api_version | ocs_status_code |
Expand Down

0 comments on commit a57c45d

Please sign in to comment.