Skip to content

Commit

Permalink
Updated exception message
Browse files Browse the repository at this point in the history
  • Loading branch information
kiranparajuli589 committed Jul 17, 2020
1 parent 5b4695a commit 48eb99e
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,11 @@ Feature: LOCK file/folder
| endpoint |
| /remote.php/dav/files/%username%/textfile0.txt |
| /remote.php/dav/files/%username%/PARENT |
Then the HTTP status code of responses on all endpoints should be "403"
When user "Brian" requests these endpoints with "LOCK" to get property "d:shared" about user "Alice"
| endpoint |
| /remote.php/dav/files/%username%/PARENT/parent.txt |
Then the HTTP status code of responses on all endpoints should be "403 404"
Then the HTTP status code of responses on all endpoints should be "404"

@skipOnOcV10 @issue-ocis-reva-9
#after fixing all issues delete this Scenario and use the one above
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ Feature: create folder using MKCOL
| /remote.php/dav/files/%username%/textfile0.txt |
| /remote.php/dav/files/%username%/PARENT |
| /remote.php/dav/files/%username%/PARENT/parent.txt |
| /remote.php/dav/files/%username%/does-not-exist |
Then the HTTP status code of responses on all endpoints should be "403"
When user "Brian" requests these endpoints with "MKCOL" including body "" about user "Alice"
| endpoint |
Expand Down
14 changes: 8 additions & 6 deletions tests/acceptance/features/apiAuthWebDav/webDavPUTAuth.feature
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ Feature: get file info using PUT
@skipOnOcis @issue-ocis-reva-9 @issue-ocis-reva-197
Scenario: send PUT requests to another user's webDav endpoints as normal user
When user "Brian" requests these endpoints with "PUT" including body "doesnotmatter" about user "Alice"
| endpoint |
| /remote.php/dav/files/%username%/textfile1.txt |
| /remote.php/dav/files/%username%/PARENTS |
| endpoint |
| /remote.php/dav/files/%username%/textfile1.txt |
| /remote.php/dav/files/%username%/PARENTS |
Then the HTTP status code of responses on all endpoints should be "403"
When user "Brian" requests these endpoints with "PUT" including body "doesnotmatter" about user "Alice"
| endpoint |
Expand Down Expand Up @@ -104,11 +104,13 @@ Feature: get file info using PUT
| /remote.php/dav/files/%username%/PARENT/parent.txt |
Then the HTTP status code of responses on all endpoints should be "204"
When the user "Alice" requests these endpoints with "PUT" with body "doesnotmatter" using basic auth and generated app password about user "Alice"
| endpoint |
# this folder is created, so gives 201 - CREATED
| /remote.php/webdav/PARENS |
| /remote.php/dav/files/%username%/FOLDERS |
| /remote.php/webdav/PARENS |
| /remote.php/dav/files/%username%/FOLDERS |
Then the HTTP status code of responses on all endpoints should be "201"
When the user "Alice" requests these endpoints with "PUT" with body "doesnotmatter" using basic auth and generated app password about user "Alice"
| endpoint |
# this folder already exists so gives 409 - CONFLICT
| /remote.php/dav/files/%username%/FOLDER |
| /remote.php/dav/files/%username%/FOLDER |
Then the HTTP status code of responses on all endpoints should be "409"
5 changes: 4 additions & 1 deletion tests/acceptance/features/bootstrap/AuthContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ public function requestEndpointsWithBasicAuthAndGeneratedPassword(
$ofUser = \strtolower($this->featureContext->getActualUsername($ofUser));
$this->featureContext->verifyTableNodeColumns($table, ['endpoint']);
$this->featureContext->emptyLastHTTPStatusCodesArray();
if (\is_null($body) && !\is_null($property)) {
if ($body === null && $property !== null) {
$body = $this->featureContext->getBodyForOCSRequest($method, $property);
}

Expand Down Expand Up @@ -382,6 +382,8 @@ public function adminRequestsEndpointsWithPassword(
TableNode $table
) {
$this->featureContext->verifyTableNodeColumns($table, ['endpoint']);
$this->featureContext->emptyLastHTTPStatusCodesArray();
$this->featureContext->emptyLastOCSStatusCodesArray();
foreach ($table->getHash() as $row) {
$this->administratorRequestsURLWithUsingBasicAuth(
$row['endpoint'],
Expand Down Expand Up @@ -466,6 +468,7 @@ public function userRequestsTheseEndpointsUsingNewBrowserSession($method, TableN
public function userRequestsEndpointsUsingTheGeneratedAppPasswordThenStatusCodeAboutUser($method, $user, TableNode $table) {
$user = \strtolower($this->featureContext->getActualUsername($user));
$this->featureContext->verifyTableNodeColumns($table, ['endpoint']);
$this->featureContext->emptyLastHTTPStatusCodesArray();
foreach ($table->getHash() as $row) {
$row['endpoint'] = $this->featureContext->substituteInLineCodes(
$row['endpoint'], $user
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/features/bootstrap/OCSContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ public function userSendsRequestToTheseEndpointsWithBody($user, $method, $body,
}

/**
* @When user "([^"]*)" requests these endpoints with "([^"]*)" to (?:get|set) property "([^"]*)" about user "([^"]*)"$/
* @When /^user "([^"]*)" requests these endpoints with "([^"]*)" to (?:get|set) property "([^"]*)" about user "([^"]*)"$/
*
* @param string $user
* @param string $method
Expand Down
10 changes: 8 additions & 2 deletions tests/acceptance/features/bootstrap/WebDav.php
Original file line number Diff line number Diff line change
Expand Up @@ -1787,7 +1787,10 @@ public function theHTTPStatusCodeOfResponsesOnAllEndpointsShouldBe($statusCode)
'Responses did not return expected http status code'
);
} else {
throw new \Exception('Expected same but found different http status codes of last requested responses');
throw new \Exception(
'Expected same but found different http status codes of last requested responses.' .
'Found status codes: ' . \implode(',', $this->lastHttpStatusCodesArray)
);
}
}

Expand All @@ -1808,7 +1811,10 @@ public function theOCSStatusCodeOfResponsesOnAllEndpointsShouldBe($statusCode) {
'Responses did not return expected ocs status code'
);
} else {
throw new \Exception('Expected same but found different ocs status codes of last requested responses');
throw new \Exception(
'Expected same but found different ocs status codes of last requested responses.' .
'Found status codes: ' . \implode(',', $this->lastOCSStatusCodesArray)
);
}
}

Expand Down

0 comments on commit 48eb99e

Please sign in to comment.