Add api tests for changing role of a space (#5088)

This commit is contained in:
Swikriti Tripathi
2022-11-23 11:40:20 +01:00
committed by GitHub
parent dc49b65594
commit 1108da1750
2 changed files with 33 additions and 2 deletions
@@ -136,3 +136,34 @@ Feature: Share spaces
| viewer | manager |
| viewer | editor |
| viewer | viewer |
Scenario Outline: space manager can change the role of space members
Given user "Alice" has shared a space "share space" to user "Brian" with role "<role>"
When user "Alice" updates the space "share space" for user "Brian" changing the role to "<new_role>"
Then the HTTP status code should be "200"
And the OCS status code should be "200"
And the user "Alice" should have a space called "share space" granted to "Brian" with role "<new_role>"
Examples:
| role | new_role |
| editor | manager |
| editor | viewer |
| viewer | manager |
| viewer | editor |
| manager | editor |
| manager | viewer |
Scenario Outline: user without manager role cannot change the role of space members
Given user "Alice" has shared a space "share space" to user "Brian" with role "<role>"
And user "Alice" has shared a space "share space" to user "Bob" with role "viewer"
When user "Brian" updates the space "share space" for user "Bob" changing the role to "<new_role>"
Then the HTTP status code should be "404"
And the OCS status code should be "404"
And the user "Alice" should have a space called "share space" granted to "Bob" with role "viewer"
Examples:
| role | new_role |
| editor | manager |
| editor | viewer |
| viewer | manager |
| viewer | editor |
@@ -1682,8 +1682,7 @@ class SpacesContext implements Context {
string $fileName,
string $spaceName
):void {
$space = $this->getSpaceByName($user, $spaceName);
$fullUrl = $space["root"]["webDavUrl"] . '/' . ltrim($fileName, "/");
$this->setSpaceIDByName($user, $spaceName);
$this->featureContext->downloadFileAsUserUsingPassword($user, $fileName, $this->featureContext->getPasswordForUser($user));
Assert::assertGreaterThanOrEqual(
400,
@@ -1790,6 +1789,7 @@ class SpacesContext implements Context {
/**
* @When /^user "([^"]*)" shares a space "([^"]*)" to user "([^"]*)" with role "([^"]*)"$/
* @When /^user "([^"]*)" updates the space "([^"]*)" for user "([^"]*)" changing the role to "([^"]*)"$/
*
* @param string $user
* @param string $spaceName