Skip to content

Commit

Permalink
Add tests for non-existent user webdav request
Browse files Browse the repository at this point in the history
  • Loading branch information
SagarGi committed Nov 23, 2022
1 parent 2f1e601 commit 4924236
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,15 @@ Feature: create folder using MKCOL
| /remote.php/dav/files/%username%/PARENT |
| /remote.php/dav/files/%username%/does-not-exist |
| /remote.php/dav/files/%username%/PARENT/parent.txt |
Then the HTTP status code of responses on each endpoint should be "403, 403, 403, 409" respectively
Then the HTTP status code of responses on each endpoint should be "403, 403, 403, 409" respectively


Scenario: send MKCOL requests to non-existent user's webDav endpoints as normal user
Given user "Brian" has been created with default attributes and without skeleton files
When user "Brian" requests these endpoints with "MKCOL" including body "" about user "non-existent-user"
| endpoint |
| /remote.php/dav/files/non-existent-user/textfile0.txt |
| /remote.php/dav/files/non-existent-user/PARENT |
| /remote.php/dav/files/non-existent-user/does-not-exist |
| /remote.php/dav/files/non-existent-user/PARENT/parent.txt |
Then the HTTP status code of responses on all endpoints should be "409"
32 changes: 27 additions & 5 deletions tests/acceptance/features/apiAuthWebDav/webDavMKCOLAuth.feature
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Feature: create folder using MKCOL
| /remote.php/dav/spaces/%spaceid%/PARENT/parent.txt |
Then the HTTP status code of responses on all endpoints should be "401"

@skipOnOcV10 @issue-ocis-reva-9 @issue-ocis-reva-197
@skipOnOcV10 @issue-ocis-5049 @issue-ocis-reva-9 @issue-ocis-reva-197
Scenario: send MKCOL requests to another user's webDav endpoints as normal user
Given user "Brian" has been created with default attributes and without skeleton files
When user "Brian" requests these endpoints with "MKCOL" including body "" about user "Alice"
Expand All @@ -59,14 +59,36 @@ Feature: create folder using MKCOL
| /remote.php/dav/files/%username%/PARENT/parent.txt |
Then the HTTP status code of responses on all endpoints should be "404"

@skipOnOcV10 @issue-ocis-5049 @issue-ocis-reva-9 @issue-ocis-reva-197
Scenario: send MKCOL requests to non-existent user's webDav endpoints as normal user
Given user "Brian" has been created with default attributes and without skeleton files
When user "Brian" requests these endpoints with "MKCOL" including body "" about user "non-existent-user"
| endpoint |
| /remote.php/dav/files/non-existent-user/textfile0.txt |
| /remote.php/dav/files/non-existent-user/PARENT |
| /remote.php/dav/files/non-existent-user/does-not-exist |
| /remote.php/dav/files/non-existent-user/PARENT/parent.txt |
Then the HTTP status code of responses on all endpoints should be "404"

@skipOnOcV10 @personalSpace @issue-ocis-reva-9 @issue-ocis-reva-197
Scenario: send MKCOL requests to another user's webDav endpoints as normal user using the spaces WebDAV API
Given user "Brian" has been created with default attributes and without skeleton files
When user "Brian" requests these endpoints with "MKCOL" including body "" about user "Alice"
| endpoint |
| /remote.php/dav/spaces/%spaceid%/textfile0.txt |
| /remote.php/dav/spaces/%spaceid%/PARENT |
| /remote.php/dav/spaces/%spaceid%/does-not-exist |
| endpoint |
| /remote.php/dav/spaces/%spaceid%/textfile0.txt |
| /remote.php/dav/spaces/%spaceid%/PARENT |
| /remote.php/dav/spaces/%spaceid%/does-not-exist |
| /remote.php/dav/spaces/%spaceid%/PARENT/parent.txt |
Then the HTTP status code of responses on all endpoints should be "404"

@skipOnOcV10 @issue-ocis-5049 @personalSpace @issue-ocis-reva-9 @issue-ocis-reva-197
Scenario: send MKCOL requests to non-existent user's webDav endpoints as normal user using the spaces WebDAV API
Given user "Brian" has been created with default attributes and without skeleton files
When user "Brian" requests these endpoints with "MKCOL" including body "" about user "non-existent-user"
| endpoint |
| /remote.php/dav/spaces/%spaceid%/textfile0.txt |
| /remote.php/dav/spaces/%spaceid%/PARENT |
| /remote.php/dav/spaces/%spaceid%/does-not-exist |
| /remote.php/dav/spaces/%spaceid%/PARENT/parent.txt |
Then the HTTP status code of responses on all endpoints should be "404"

Expand Down
3 changes: 3 additions & 0 deletions tests/acceptance/features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -3329,6 +3329,9 @@ public function substituteInLineCodes(
* @throws GuzzleException
*/
public function getPersonalSpaceIdForUser(string $user, bool $alwaysDoIt = false): ?string {
if ($user === 'non-existent-user') {
return WebDavHelper::generateUUIDv4();
}
if ($alwaysDoIt || ($this->getDavPathVersion() === WebDavHelper::DAV_VERSION_SPACES)) {
return WebDavHelper::getPersonalSpaceIdForUser(
$this->getBaseUrl(),
Expand Down

0 comments on commit 4924236

Please sign in to comment.