[tests-only] Fix API test steps (#7457)

* add missing step defs

* fix steps

* update expected failure line
This commit is contained in:
Sawjan Gurung
2023-10-11 15:10:02 +05:45
committed by GitHub
parent 9e07f2f0d1
commit 383ad91815
5 changed files with 18 additions and 20 deletions

View File

@@ -332,14 +332,14 @@ API, search, favorites, config, capabilities, not existing endpoints, CORS and o
#### [Ability to return error messages in Webdav response bodies](https://github.com/owncloud/ocis/issues/1293)
- [coreApiAuthOcs/ocsDELETEAuth.feature:10](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuthOcs/ocsDELETEAuth.feature#L10)
- [coreApiAuthOcs/ocsDELETEAuth.feature:7](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuthOcs/ocsDELETEAuth.feature#L7)
- [coreApiAuthOcs/ocsGETAuth.feature:10](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuthOcs/ocsGETAuth.feature#L10)
- [coreApiAuthOcs/ocsGETAuth.feature:44](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuthOcs/ocsGETAuth.feature#L44)
- [coreApiAuthOcs/ocsGETAuth.feature:75](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuthOcs/ocsGETAuth.feature#L75)
- [coreApiAuthOcs/ocsGETAuth.feature:106](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuthOcs/ocsGETAuth.feature#L106)
- [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)
- [coreApiAuthOcs/ocsPUTAuth.feature:7](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuthOcs/ocsPUTAuth.feature#L7)
- [coreApiSharePublicLink1/createPublicLinkShare.feature:317](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiSharePublicLink1/createPublicLinkShare.feature#L317)
#### [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)
@@ -432,7 +432,7 @@ And other missing implementation of favorites
#### [Request to edit non-existing user by authorized admin gets unauthorized in http response](https://github.com/owncloud/core/issues/38423)
- [coreApiAuthOcs/ocsPUTAuth.feature:26](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuthOcs/ocsPUTAuth.feature#L26)
- [coreApiAuthOcs/ocsPUTAuth.feature:22](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuthOcs/ocsPUTAuth.feature#L22)
#### [Sharing a same file twice to the same group](https://github.com/owncloud/ocis/issues/1710)

View File

@@ -276,8 +276,17 @@ class AuthContext implements Context {
* @return void
* @throws Exception
*/
public function adminRequestsEndpoint(string $method, TableNode $table):void {
$this->adminRequestsEndpointsWithBodyWithPassword($method, null, null, null, $table);
public function theAdminRequestsTheseEndpointsWithMethod(string $method, TableNode $table):void {
$this->featureContext->verifyTableNodeColumns($table, ['endpoint']);
foreach ($table->getHash() as $row) {
$response = $this->requestUrlWithBasicAuth(
$this->featureContext->getAdminUsername(),
$row['endpoint'],
$method
);
$this->featureContext->setResponse($response);
$this->featureContext->pushToLastStatusCodesArrays();
}
}
/**

View File

@@ -3,13 +3,9 @@ Feature: auth
I want to send delete request with wrong password
So that I can make sure it doesn't work
Background:
Given user "another-admin" has been created with default attributes and without skeleton files
@smokeTest @issue-1337 @issue-1319
Scenario: send DELETE requests to OCS endpoints as admin with wrong password
Given user "another-admin" has been added to group "admin"
When user "another-admin" requests these endpoints with "DELETE" using password "invalid" about user "Alice"
When user "admin" requests these endpoints with "DELETE" using password "invalid" about user "Alice"
| endpoint |
| /ocs/v1.php/apps/files_sharing/api/v1/remote_shares/pending/123 |
| /ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/123 |

View File

@@ -121,9 +121,7 @@ Feature: auth
@issue-1337 @issue-1319
Scenario: using OCS as admin user with wrong password
Given user "another-admin" has been created with default attributes and without skeleton files
And user "another-admin" has been added to group "admin"
When user "another-admin" requests these endpoints with "GET" using password "invalid"
When user "admin" requests these endpoints with "GET" using password "invalid"
| endpoint |
| /ocs/v1.php/apps/files_sharing/api/v1/remote_shares |
| /ocs/v2.php/apps/files_sharing/api/v1/remote_shares |

View File

@@ -3,13 +3,9 @@ Feature: auth
I want to send PUT request to various endpoints
So that I can make sure the endpoints need proper authentication
Background:
Given user "another-admin" has been created with default attributes and without skeleton files
@issue-1337 @smokeTest
Scenario: send PUT request to OCS endpoints as admin with wrong password
Given user "another-admin" has been added to group "admin"
When user "another-admin" requests these endpoints with "PUT" including body "doesnotmatter" using password "invalid" about user "Alice"
When user "admin" requests these endpoints with "PUT" including body "doesnotmatter" using password "invalid" about user "Alice"
| endpoint |
| /ocs/v1.php/cloud/users/%username% |
| /ocs/v2.php/cloud/users/%username% |
@@ -24,8 +20,7 @@ Feature: auth
Scenario: request to edit nonexistent user by authorized admin gets unauthorized in http response
Given user "another-admin" has been added to group "admin"
When user "another-admin" requests these endpoints with "PUT" including body "doesnotmatter" about user "nonexistent"
When user "admin" requests these endpoints with "PUT" including body "doesnotmatter" about user "nonexistent"
| endpoint |
| /ocs/v1.php/cloud/users/%username% |
| /ocs/v2.php/cloud/users/%username% |