mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-06 04:09:40 -06:00
[test-only] apiTest. Delete group from the space (#5365)
* add test * add empty line
This commit is contained in:
@@ -60,7 +60,7 @@ Feature: Share spaces
|
||||
| name | share space |
|
||||
When user "Alice" unshares a space "share space" to user "Brian"
|
||||
Then the HTTP status code should be "200"
|
||||
Then the user "Brian" should not have a space called "share space"
|
||||
And the user "Brian" should not have a space called "share space"
|
||||
|
||||
|
||||
Scenario Outline: Owner of a space cannot see the space after removing his access to the space
|
||||
@@ -188,3 +188,44 @@ Feature: Share spaces
|
||||
| manager |
|
||||
| editor |
|
||||
| viewer |
|
||||
|
||||
|
||||
Scenario Outline: The user has no access to the space if access for the group has been removed
|
||||
Given group "group2" has been created
|
||||
And the administrator has added a user "Brian" to the group "group2" using GraphApi
|
||||
And user "Alice" has shared a space "share space" to group "group2" with role "<role>"
|
||||
When user "Alice" unshares a space "share space" to group "group2"
|
||||
Then the HTTP status code should be "200"
|
||||
And the user "Brian" should not have a space called "share space"
|
||||
Examples:
|
||||
| role |
|
||||
| manager |
|
||||
| editor |
|
||||
| viewer |
|
||||
|
||||
|
||||
Scenario: The user has no access to the space if he has been removed from the group
|
||||
Given group "group2" has been created
|
||||
And the administrator has added a user "Brian" to the group "group2" using GraphApi
|
||||
And the administrator has added a user "Bob" to the group "group2" using GraphApi
|
||||
And user "Alice" has shared a space "share space" to group "group2" with role "editor"
|
||||
When the administrator removes the following users from the following groups using the Graph API
|
||||
| username | groupname |
|
||||
| Brian | group2 |
|
||||
Then the HTTP status code of responses on all endpoints should be "204"
|
||||
And the user "Brian" should not have a space called "share space"
|
||||
But the user "Bob" should have a space called "share space" with these key and value pairs:
|
||||
| key | value |
|
||||
| driveType | project |
|
||||
| name | share space |
|
||||
|
||||
|
||||
Scenario: Users don't have access to the space if the group has been deleted
|
||||
Given group "group2" has been created
|
||||
And the administrator has added a user "Brian" to the group "group2" using GraphApi
|
||||
And the administrator has added a user "Bob" to the group "group2" using GraphApi
|
||||
And user "Alice" has shared a space "share space" to group "group2" with role "editor"
|
||||
When the administrator deletes group "group2" using the Graph API
|
||||
Then the HTTP status code should be "204"
|
||||
And the user "Brian" should not have a space called "share space"
|
||||
And the user "Bob" should not have a space called "share space"
|
||||
@@ -1021,7 +1021,7 @@ class GraphContext implements Context {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function userDeletesGroupUsingTheGraphApi(string $group, ?string $user): void {
|
||||
public function userDeletesGroupUsingTheGraphApi(string $group, ?string $user = null): void {
|
||||
$groupId = $this->featureContext->getAttributeOfCreatedGroup($group, "id");
|
||||
$response = $this->userDeletesGroupWithGroupId($groupId, $user);
|
||||
$this->featureContext->setResponse($response);
|
||||
|
||||
@@ -2040,11 +2040,11 @@ class SpacesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^user "([^"]*)" has shared a space "([^"]*)" to user "([^"]*)" with role "([^"]*)"$/
|
||||
* @Given /^user "([^"]*)" has shared a space "([^"]*)" to (?:user|group) "([^"]*)" with role "([^"]*)"$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $spaceName
|
||||
* @param string $userRecipient
|
||||
* @param string $recipient
|
||||
* @param string $role
|
||||
*
|
||||
* @return void
|
||||
@@ -2053,10 +2053,10 @@ class SpacesContext implements Context {
|
||||
public function userHasSharedSpace(
|
||||
string $user,
|
||||
string $spaceName,
|
||||
string $userRecipient,
|
||||
string $recipient,
|
||||
string $role
|
||||
): void {
|
||||
$this->sendShareSpaceRequest($user, $spaceName, $userRecipient, $role);
|
||||
$this->sendShareSpaceRequest($user, $spaceName, $recipient, $role);
|
||||
$expectedHTTPStatus = "200";
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(
|
||||
$expectedHTTPStatus,
|
||||
@@ -2067,11 +2067,11 @@ class SpacesContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" unshares a space "([^"]*)" to user "([^"]*)"$/
|
||||
* @When /^user "([^"]*)" unshares a space "([^"]*)" to (?:user|group) "([^"]*)"$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $spaceName
|
||||
* @param string $userRecipient
|
||||
* @param string $recipient
|
||||
*
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
@@ -2079,10 +2079,10 @@ class SpacesContext implements Context {
|
||||
public function sendUnshareSpaceRequest(
|
||||
string $user,
|
||||
string $spaceName,
|
||||
string $userRecipient
|
||||
string $recipient
|
||||
): void {
|
||||
$space = $this->getSpaceByName($user, $spaceName);
|
||||
$fullUrl = $this->baseUrl . $this->ocsApiUrl . "/" . $space['id'] . "?shareWith=" . $userRecipient;
|
||||
$fullUrl = $this->baseUrl . $this->ocsApiUrl . "/" . $space['id'] . "?shareWith=" . $recipient;
|
||||
|
||||
$this->featureContext->setResponse(
|
||||
HttpRequestHelper::delete(
|
||||
|
||||
Reference in New Issue
Block a user