Skip to content

Commit

Permalink
add failed test to expected failures file
Browse files Browse the repository at this point in the history
  • Loading branch information
ScharfViktor committed Oct 26, 2023
1 parent 71a7640 commit d4e8253
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 4 deletions.
11 changes: 11 additions & 0 deletions tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,5 +143,16 @@ The expected failures in this file are from features in the owncloud/ocis repo.

- [apiGraph/addUserToGroup.feature:420](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/addUserToGroup.feature#L420)

### [500 error if viewer tries to lock file](https://github.com/owncloud/ocis/issues/7600)

- [apiSpaces/lockFiles.feature:144](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/lockFiles.feature#144)
- [apiSpaces/lockFiles.feature:207](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/lockFiles.feature#207)

### [Shared file locking is not possible using different path](https://github.com/owncloud/ocis/issues/7599)

- [apiSpaces/lockFiles.feature:179](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/lockFiles.feature#179)
- [apiSpaces/lockFiles.feature:180](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/lockFiles.feature#180)
- [apiSpaces/lockFiles.feature:181](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/lockFiles.feature#181)

Note: always have an empty line at the end of this file.
The bash script that processes this file requires that the last line has a newline on the end.
24 changes: 21 additions & 3 deletions tests/acceptance/features/apiSpaces/lockFiles.feature
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ Feature: lock files
| key | value |
| d:lockdiscovery/d:activelock/d:lockscope/d:exclusive | |
| d:lockdiscovery/d:activelock/d:depth | Infinity |
# can be failed Second-4999
| d:lockdiscovery/d:activelock/d:timeout | Second-5000 |
| d:lockdiscovery/d:activelock/oc:ownername | Alice Hansen |
Examples:
Expand Down Expand Up @@ -155,11 +154,12 @@ Feature: lock files
| lockscope | exclusive |
Then the HTTP status code should be "403"
When user "Brian" locks file using file-id path "/dav/spaces/<<FILEID>>" using the WebDAV API setting the following properties
| lockscope | exclusive |
| lockscope | exclusive |
Then the HTTP status code should be "403"


Scenario: locking a file in the shares
Scenario Outline: locking a file in the shares
Given using <dav-path-version> DAV path
And user "Alice" has uploaded a file inside space "Alice Hansen" with content "some content" to "textfile.txt"
When user "Alice" creates a share inside of space "Alice Hansen" with settings:
| path | textfile.txt |
Expand All @@ -174,6 +174,11 @@ Feature: lock files
| key | value |
| d:lockdiscovery/d:activelock/d:lockscope/d:exclusive | |
| d:lockdiscovery/d:activelock/oc:ownername | Brian Murphy |
Examples:
| dav-path-version |
| old |
| new |
| spaces |


Scenario Outline: locking a file in the shares using file-id
Expand All @@ -197,3 +202,16 @@ Feature: lock files
| dav-path |
| /remote.php/dav/spaces/<<FILEID>> |
| /dav/spaces/<<FILEID>> |


Scenario: viewer cannot lock a file in the shares using file-id
And user "Alice" has uploaded a file inside space "Alice Hansen" with content "some content" to "textfile.txt"
And we save it into "FILEID"
When user "Alice" creates a share inside of space "Alice Hansen" with settings:
| path | textfile.txt |
| shareWith | Brian |
| role | viewer |
When user "Brian" locks file using file-id path "<dav-path>" using the WebDAV API setting the following properties
| lockscope | exclusive |
Then the HTTP status code should be "403"

15 changes: 14 additions & 1 deletion tests/acceptance/features/bootstrap/SpacesContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -3509,7 +3509,8 @@ public function theResponseShouldContainSpace(string $method, string $space, Tab
}

/**
* @Then /^the "([^"]*)" response to user "([^"]*)" should contain a mountpoint|space "([^"]*)" with these key and value pairs:$/
* @Then /^the "([^"]*)" response to user "([^"]*)" should contain a mountpoint "([^"]*)" with these key and value pairs:$/
* @Then /^the "([^"]*)" response to user "([^"]*)" should contain a space "([^"]*)" with these key and value pairs:$/
*
* @param string $method # method should be either PROPFIND or REPORT
* @param string $user
Expand Down Expand Up @@ -3577,6 +3578,18 @@ public function theResponseShouldContain(string $method, string $user, string $s
$actualTags = \sort($actualTags);
Assert::assertEquals($expectedTags, $actualTags, "wrong $findItem in the response");
break;
case "d:lockdiscovery/d:activelock/d:timeout":
if ($value === "Infinity") {
Assert::assertEquals($value, $responseValue, "wrong $findItem in the response");
} else {
// some time may be required between a lock and propfind request.
$responseValue = explode('-', $responseValue);
$responseValue = \intval($responseValue[1]);
$value = explode('-', $value);
$value = \intval($value[1]);
Assert::assertTrue($responseValue >= ($value - 3));
}
break;
default:
Assert::assertEquals($value, $responseValue, "wrong $findItem in the response");
break;
Expand Down

0 comments on commit d4e8253

Please sign in to comment.