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

[tests-only][full-ci] added test for mail notification if space admin delete access to space #6657

Merged
merged 1 commit into from
Jul 4, 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
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,23 @@ Feature: Email notification

Zum Ansehen hier klicken: %base_url%/f/%space_id%
"""


Scenario: user gets an email notification when space admin unshares a space
Given the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
And user "Alice" has created a space "new-space" with the default quota using the GraphApi
And user "Alice" has shared a space "new-space" with settings:
| shareWith | Brian |
| role | editor |
When user "Alice" unshares a space "new-space" to user "Brian"
Then the HTTP status code should be "200"
And user "Brian" should have received the following email from user "Alice" about the share of project space "new-space"
"""
Hello Brian Murphy,

%displayname% has removed you from "new-space".

You might still have access through your other groups or direct membership.

Click here to check it: %base_url%/f/%space_id%
"""
4 changes: 2 additions & 2 deletions tests/acceptance/features/bootstrap/NotificationContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ public function userShouldHaveReceivedTheFollowingEmailFromUserAboutTheShareOfPr
[
"code" => "%space_id%",
"function" =>
[$this->spacesContext, "getSpaceIdByNameFromResponse"],
"parameter" => [$spaceName]
[$this->spacesContext, "getSpaceIdByName"],
"parameter" => [$sender, $spaceName]
],
],
null,
Expand Down
18 changes: 18 additions & 0 deletions tests/acceptance/features/bootstrap/SpacesContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,24 @@ public function getSpaceByName(string $user, string $spaceName): array {
return $spaces[$spaceName];
}

/**
* The method finds the space of a user by name and returns the space id
*
* @param string $user
* @param string $spaceName
*
* @return string
* @throws GuzzleException
*/
public function getSpaceIdByName(string $user, string $spaceName): string {
$space = $this->getSpaceByName($user, $spaceName);
Assert::assertIsArray($space, "Space with name $spaceName not found");
if (!isset($space["id"])) {
throw new Exception(__METHOD__ . " space with name $spaceName not found in $space");
}
return $space["id"];
}

/**
* This method sets space id by Space Name
* This is currently used to set space id from ocis in core so that we can reuse available resource (code) and avoid duplication
Expand Down