Skip to content

Commit

Permalink
Merge pull request #2757 from owncloud/spaces-tests-20211112
Browse files Browse the repository at this point in the history
[tests-only] Add test step about 'space contains for user'
  • Loading branch information
phil-davis authored Nov 19, 2021
2 parents 7b8dbf5 + 1a76adc commit 287fb1b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 6 deletions.
11 changes: 5 additions & 6 deletions tests/acceptance/features/apiSpaces/uploadSpaces.feature
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Feature: Upload files into a space
And user "Alice" lists all available spaces via the GraphApi
And user "Alice" creates a folder "mainFolder" in space "Project Venus" using the WebDav Api
Then the HTTP status code should be "201"
And the space "Project Venus" should contain these entries:
And for user "Alice" the space "Project Venus" should contain these entries:
| mainFolder |

Scenario: Bob creates a folder via the Graph api in a space, he expects a 404 code and Alice checks that this folder does not exist
Expand All @@ -25,7 +25,7 @@ Feature: Upload files into a space
And user "Alice" lists all available spaces via the GraphApi
And user "Bob" creates a folder "forAlice" in space "Project Merkur" using the WebDav Api
Then the HTTP status code should be "404"
And the space "Project Merkur" should not contain these entries:
And for user "Alice" the space "Project Merkur" should not contain these entries:
| forAlice |

Scenario: Alice creates a folder via Graph api and uploads a file
Expand All @@ -36,7 +36,7 @@ Feature: Upload files into a space
Then the HTTP status code should be "201"
And user "Alice" uploads a file inside space "Project Moon" with content "Test" to "test.txt" using the WebDAV API
Then the HTTP status code should be "201"
And the space "Project Moon" should contain these entries:
And for user "Alice" the space "Project Moon" should contain these entries:
| NewFolder |
| test.txt |

Expand All @@ -46,7 +46,7 @@ Feature: Upload files into a space
And user "Alice" lists all available spaces via the GraphApi
And user "Bob" uploads a file inside space "Project Pluto" with content "Test" to "test.txt" using the WebDAV API
Then the HTTP status code should be "404"
And the space "Project Pluto" should not contain these entries:
And for user "Alice" the space "Project Pluto" should not contain these entries:
| test.txt |

Scenario: Alice creates uploads a file and checks her quota
Expand All @@ -61,8 +61,7 @@ Feature: Upload files into a space
And user "Alice" lists all available spaces via the GraphApi
And user "Alice" uploads a file inside space "Project Saturn" with content "Test" to "test.txt" using the WebDAV API
Then the HTTP status code should be "201"
When user "Alice" lists the content of the space with the name "Project Saturn" using the WebDav Api
Then the propfind result of the space should contain these entries:
And for user "Alice" the space "Project Saturn" should contain these entries:
| test.txt |
And user "Alice" lists all available spaces via the GraphApi
And the json responded should contain a space "Project Saturn" with these key and value pairs:
Expand Down
28 changes: 28 additions & 0 deletions tests/acceptance/features/bootstrap/SpacesContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,34 @@ public function theSpaceShouldContainEntries(
);
}

/**
* @Then /^for user "([^"]*)" the space "([^"]*)" should (not|)\s?contain these (?:files|entries):$/
*
* @param string $user
* @param string $spaceName
* @param string $shouldOrNot (not|)
* @param TableNode $expectedFiles
*
* @return void
*
* @throws Exception|GuzzleException
*/
public function usertheSpaceShouldContainEntries(
string $user,
string $spaceName,
string $shouldOrNot,
TableNode $expectedFiles
):void {
$this->theUserListsTheContentOfAPersonalSpaceRootUsingTheWebDAvApi(
$user,
$spaceName
);
$this->propfindResultShouldContainEntries(
$shouldOrNot,
$expectedFiles,
);
}

/**
* @Then /^the json responded should contain a space "([^"]*)" with these key and value pairs:$/
*
Expand Down

0 comments on commit 287fb1b

Please sign in to comment.