Skip to content

Commit

Permalink
add test to disable notification for Removed as space member event
Browse files Browse the repository at this point in the history
Signed-off-by: prashant-gurung899 <[email protected]>
  • Loading branch information
prashant-gurung899 committed Jan 22, 2025
1 parent 665072d commit b09f941
Show file tree
Hide file tree
Showing 2 changed files with 136 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests/acceptance/bootstrap/NotificationContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,10 @@ public function filterNotificationsBySubjectAndResource(
$notifications = $responseObject->ocs->data;
foreach ($notifications as $notification) {
if (isset($notification->subject) && $notification->subject === $subject
&& isset($notification->messageRichParameters->resource->name)
&& $notification->messageRichParameters->resource->name === $resource
&& ((isset($notification->messageRichParameters->resource->name)
&& $notification->messageRichParameters->resource->name === $resource)
|| (isset($notification->messageRichParameters->space->name)
&& $notification->messageRichParameters->space->name === $resource))
) {
$this->notificationIds[] = $notification->notification_id;
$filteredNotifications[] = $notification;
Expand Down Expand Up @@ -466,7 +468,7 @@ public function userShouldGetNotificationForResourceWithMessage(
}

/**
* @Then user :user should not have a notification related to resource :resource with subject :subject
* @Then /^user "([^"]*)" should not have a notification related to (resource|space) "([^"]*)" with subject "([^"]*)"$/
*
* @param string $user
* @param string $resource
Expand Down
131 changes: 131 additions & 0 deletions tests/acceptance/features/apiSettings/notificationSetting.feature
Original file line number Diff line number Diff line change
Expand Up @@ -444,3 +444,134 @@ Feature: Notification Settings
| message |
| Alice Hansen shared insideSpace.txt with you |
But user "Brian" should not have a notification related to resource "insideSpace.txt" with subject "Resource unshared"


Scenario: disable mail and in-app notification for Removed as space member event
Given using spaces DAV path
And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
And user "Alice" has created a space "newSpace" with the default quota using the Graph API
And user "Alice" has sent the following space share invitation:
| space | newSpace |
| sharee | Brian |
| shareType | user |
| permissionsRole | Space Viewer |
When user "Brian" disables notification for the following events using the settings API:
| Removed as space member | mail,in-app |
Then the HTTP status code should be "201"
And the JSON data of the response should match
"""
{
"type": "object",
"required": ["value"],
"properties": {
"value": {
"type": "object",
"required": ["identifier","value"],
"properties": {
"identifier":{
"type": "object",
"required": ["extension","bundle","setting"],
"properties": {
"extension":{
"const": "ocis-accounts"
},
"bundle":{
"const": "profile"
},
"setting":{
"const": "event-space-unshared-options"
}
}
},
"value":{
"type": "object",
"required": [
"id",
"bundleId",
"settingId",
"accountUuid",
"resource",
"collectionValue"
],
"properties":{
"id":{
"pattern":"%user_id_pattern%"
},
"bundleId":{
"pattern":"%user_id_pattern%"
},
"settingId":{
"pattern":"%user_id_pattern%"
},
"accountUuid":{
"pattern":"%user_id_pattern%"
},
"resource":{
"type": "object",
"required":["type"],
"properties": {
"type":{
"const": "TYPE_USER"
}
}
},
"collectionValue":{
"type": "object",
"required":["values"],
"properties": {
"values":{
"type": "array",
"maxItems": 2,
"minItems": 2,
"uniqueItems": true,
"items": {
"oneOf": [
{
"type": "object",
"required": [
"key",
"boolValue"
],
"properties": {
"key":{
"const": "mail"
},
"boolValue":{
"const": false
}
}
},
{
"type": "object",
"required": [
"key",
"boolValue"
],
"properties": {
"key":{
"const": "in-app"
},
"boolValue":{
"const": false
}
}
}
]
}
}
}
}
}
}
}
}
}
}
"""
And user "Alice" has removed the access of user "Brian" from space "newSpace"
When user "Brian" lists all notifications
Then the HTTP status code should be "200"
And user "Brian" should get a notification with subject "Space shared" and message:
| message |
| Alice Hansen added you to Space newSpace |
But user "Brian" should not have a notification related to space "newSpace" with subject "Removed from Space"

0 comments on commit b09f941

Please sign in to comment.