Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[test-only] apiTest. Delete group from the space #5365

Merged
merged 2 commits into from
Jan 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 42 additions & 1 deletion tests/acceptance/features/apiSpacesShares/shareSpaces.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
2 changes: 1 addition & 1 deletion tests/acceptance/features/bootstrap/GraphContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,7 @@ public function theLastResponseShouldBeUnauthorizedReponse(): void {
*
* @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);
Expand Down
16 changes: 8 additions & 8 deletions tests/acceptance/features/bootstrap/SpacesContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -2040,11 +2040,11 @@ public function userHasCreatedPublicLinkToEntityInsideOfSpaceRequest(
}

/**
* @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
Expand All @@ -2053,10 +2053,10 @@ public function userHasCreatedPublicLinkToEntityInsideOfSpaceRequest(
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,
Expand All @@ -2067,22 +2067,22 @@ public function userHasSharedSpace(
}

/**
* @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
*/
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(
Expand Down